Skip to content

Commit d0c0d90

Browse files
Colin Ian Kingmartinkpetersen
authored andcommitted
scsi: bnx2fc: fix incorrect cast to u64 on shift operation
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: 7b59476 ("[SCSI] bnx2fc: Handle REC_TOV error code from firmware") Signed-off-by: Colin Ian King <[email protected]> Acked-by: Saurav Kashyap <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 8ef860a commit d0c0d90

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/scsi/bnx2fc/bnx2fc_hwi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ static void bnx2fc_process_unsol_compl(struct bnx2fc_rport *tgt, u16 wqe)
830830
((u64)err_entry->data.err_warn_bitmap_hi << 32) |
831831
(u64)err_entry->data.err_warn_bitmap_lo;
832832
for (i = 0; i < BNX2FC_NUM_ERR_BITS; i++) {
833-
if (err_warn_bit_map & (u64) (1 << i)) {
833+
if (err_warn_bit_map & ((u64)1 << i)) {
834834
err_warn = i;
835835
break;
836836
}

0 commit comments

Comments
 (0)