[patch] bnx2fc: fix test of "err_warn_bit_map"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <dan.carpenter@xxxxxxxxxx>
---
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;
 			}
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux