[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1352145183-29355-3-git-send-email-xi.wang@gmail.com>
Date: Mon, 5 Nov 2012 14:53:02 -0500
From: Xi Wang <xi.wang@...il.com>
To: Xiangliang Yu <yuxiangl@...vell.com>
Cc: Xi Wang <xi.wang@...il.com>,
"James E.J. Bottomley" <JBottomley@...allels.com>,
linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 2/3] [SCSI] mvsas: fix shift in mvs_94xx_free_reg_set()
Invoking bit(n) with n >= 64 is undefined behavior, since bit(n) does
a 64-bit shift. This patch adds a check on the shifting amount.
Signed-off-by: Xi Wang <xi.wang@...il.com>
---
drivers/scsi/mvsas/mv_94xx.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/mvsas/mv_94xx.c b/drivers/scsi/mvsas/mv_94xx.c
index 7e423e5..e1f35d4 100644
--- a/drivers/scsi/mvsas/mv_94xx.c
+++ b/drivers/scsi/mvsas/mv_94xx.c
@@ -715,11 +715,13 @@ static void mvs_94xx_free_reg_set(struct mvs_info *mvi, u8 *tfs)
if (*tfs == MVS_ID_NOT_MAPPED)
return;
- mvi->sata_reg_set &= ~bit(reg_set);
- if (reg_set < 32)
+ if (reg_set < 32) {
+ mvi->sata_reg_set &= ~bit(reg_set);
w_reg_set_enable(reg_set, (u32)mvi->sata_reg_set);
- else
+ } else if (reg_set < 64) {
+ mvi->sata_reg_set &= ~bit(reg_set);
w_reg_set_enable(reg_set, (u32)(mvi->sata_reg_set >> 32));
+ }
*tfs = MVS_ID_NOT_MAPPED;
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists