[patch] bnx2fc: fix test of "err_warn_bit_map"

From: Dan Carpenter
Date: Fri Jan 30 2015 - 03:50:16 EST


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 linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/