LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [patch] bnx2fc: fix test of "err_warn_bit_map"
@ 2015-01-30 8:49 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2015-01-30 8:49 UTC (permalink / raw)
To: QLogic-Storage-Upstream
Cc: James E.J. Bottomley, linux-scsi, linux-kernel, kernel-janitors
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@oracle.com>
---
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;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-01-30 8:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-30 8:49 [patch] bnx2fc: fix test of "err_warn_bit_map" Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).