OSDN Git Service

scsi: bnx2fc: fix incorrect cast to u64 on shift operation
authorColin Ian King <colin.king@canonical.com>
Sat, 4 May 2019 16:48:29 +0000 (17:48 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 22 Jun 2019 06:17:20 +0000 (08:17 +0200)
commit8d9ab8b1865478709df3f390e321e81471d9e483
tree6b3f07fae5059bef9e701bd576ba39fe64b73571
parent3acca2a1cbdfcc6064551b9502fe62be7cc23b6b
scsi: bnx2fc: fix incorrect cast to u64 on shift operation

[ Upstream commit d0c0d902339249c75da85fd9257a86cbb98dfaa5 ]

Currently an int is being shifted and the result is being cast to a u64
which leads to undefined behaviour if the shift is more than 31 bits. Fix
this by casting the integer value 1 to u64 before the shift operation.

Addresses-Coverity: ("Bad shift operation")
Fixes: 7b594769120b ("[SCSI] bnx2fc: Handle REC_TOV error code from firmware")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/bnx2fc/bnx2fc_hwi.c