]> 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)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 5 Oct 2019 15:19:37 +0000 (16:19 +0100)
commit1462cd0da1668beaa1cc4162742c6f6732ed42d8
treea0f6dfe1d43bc33a7e16cebe5003c0a354d8aac3
parentbed8a62bed492e4654388ebd3fa3672ff5852064
scsi: bnx2fc: fix incorrect cast to u64 on shift operation

commit d0c0d902339249c75da85fd9257a86cbb98dfaa5 upstream.

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: Ben Hutchings <ben@decadent.org.uk>
drivers/scsi/bnx2fc/bnx2fc_hwi.c