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@xxxxxxxxx> --- 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-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html