]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
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>
Wed, 19 Jun 2019 06:18:03 +0000 (08:18 +0200)
commitccc9ba8d2508a4a37d111f2e310f896572d0adff
tree119c686937d29e73824e6ad73d382e892f40a6bd
parentd7a32c8a1ce1b475bb0aab926a8a7326f4dfc6f2
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