From: Xi Wang <xi.wang@gmail.com>
To: Xiangliang Yu <yuxiangl@marvell.com>
Cc: Xi Wang <xi.wang@gmail.com>,
"James E.J. Bottomley" <JBottomley@parallels.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] [SCSI] mvsas: fix shift in mvs_94xx_free_reg_set()
Date: Mon, 5 Nov 2012 14:53:02 -0500 [thread overview]
Message-ID: <1352145183-29355-3-git-send-email-xi.wang@gmail.com> (raw)
In-Reply-To: <1352145183-29355-1-git-send-email-xi.wang@gmail.com>
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@gmail.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
next prev parent reply other threads:[~2012-11-05 19:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-05 19:53 [PATCH 0/3] [SCSI] mvsas: fix multiple shift issues Xi Wang
2012-11-05 19:53 ` [PATCH 1/3] [SCSI] mvsas: fix shift in mvs_94xx_assign_reg_set() Xi Wang
2012-11-05 19:53 ` Xi Wang [this message]
2012-11-06 12:06 ` [PATCH 2/3] [SCSI] mvsas: fix shift in mvs_94xx_free_reg_set() James Bottomley
2012-11-06 20:55 ` Xi Wang
2012-11-09 7:30 ` Xiangliang Yu
2012-11-09 13:44 ` Xi Wang
2012-11-16 7:39 ` Xiangliang Yu
2012-11-05 19:53 ` [PATCH 3/3] [SCSI] mvsas: fix shift in mv_ffc64() Xi Wang
2012-11-16 19:40 ` [PATCH v2] [SCSI] mvsas: fix undefined bit shift Xi Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1352145183-29355-3-git-send-email-xi.wang@gmail.com \
--to=xi.wang@gmail.com \
--cc=JBottomley@parallels.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=yuxiangl@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.