[patch] bnx2fc: fix test of "err_warn_bit_map"

DORMANTno replies

From: Dan Carpenter <hidden>
Date: 2015-01-30 08:50:11
Also in: linux-scsi, lkml
Subsystem: broadcom bnx2fc 10 gigabit fcoe driver, scsi subsystem, the rest · Maintainers: Saurav Kashyap, Javed Hasan, "James E.J. Bottomley", "Martin K. Petersen", Linus Torvalds

The bug in this code is "if (err_warn_bit_map & (u64) (1 << i)) {".
The cast to u64 happens after we have already shift wrapped so it's too
late.  Presumably this means some warnings are ignored.

I also cleanup the other err_warn_bit_map check.

Signed-off-by: Dan Carpenter <redacted>
---
Not tested.
diff --git a/drivers/scsi/bnx2fc/bnx2fc_hwi.c b/drivers/scsi/bnx2fc/bnx2fc_hwi.c
index c6688d7..a0cb702 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_hwi.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_hwi.c
@@ -734,7 +734,7 @@ static void bnx2fc_process_unsol_compl(struct bnx2fc_rport *tgt, u16 wqe)
 			((u64)err_entry->data.err_warn_bitmap_hi << 32) |
 			(u64)err_entry->data.err_warn_bitmap_lo;
 		for (i = 0; i < BNX2FC_NUM_ERR_BITS; i++) {
-			if (err_warn_bit_map & (u64)((u64)1 << i)) {
+			if (err_warn_bit_map & 1ULL << i) {
 				err_warn = i;
 				break;
 			}
@@ -829,7 +829,7 @@ ret_err_rqe:
 			((u64)err_entry->data.err_warn_bitmap_hi << 32) |
 			(u64)err_entry->data.err_warn_bitmap_lo;
 		for (i = 0; i < BNX2FC_NUM_ERR_BITS; i++) {
-			if (err_warn_bit_map & (u64) (1 << i)) {
+			if (err_warn_bit_map & 1ULL << i) {
 				err_warn = i;
 				break;
 			}
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help