RE: [PATCH] [SCSI] mpt2sas: Fix possible integer truncation of cpu_count

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch seem to be fine.
Please consider this patch as acked by me.

Regards,
Nagalakshmi


-----Original Message-----
From: Roland Dreier [mailto:roland@xxxxxxxxxxxxxxx] On Behalf Of Roland Dreier
Sent: Thursday, December 01, 2011 6:01 AM
To: James E.J. Bottomley
Cc: Nandigama, Nagalakshmi; linux-scsi@xxxxxxxxxxxxxxx
Subject: [PATCH] [SCSI] mpt2sas: Fix possible integer truncation of cpu_count

From: Roland Dreier <roland@xxxxxxxxxxxxxxx>

When computing reply_queue_count (the number of MSI-X vectors to use),
the driver does

	ioc->reply_queue_count = min_t(u8, ioc->cpu_count,
	    ioc->msix_vector_count);

However, on a big machine, ioc->cpu_count could be outside the range
that fits in a u8; eg a system with 256 CPUs will end up
reply_queue_count set to 0.

Fix this by calculating the minimum as ints and then letting the
assignment to reply_queue_count handle integer demotion.

Signed-off-by: Roland Dreier <roland@xxxxxxxxxxxxxxx>
---
 drivers/scsi/mpt2sas/mpt2sas_base.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
index beda04a..9596ced 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -1346,7 +1346,7 @@ _base_enable_msix(struct MPT2SAS_ADAPTER *ioc)
 	if (_base_check_enable_msix(ioc) != 0)
 		goto try_ioapic;
 
-	ioc->reply_queue_count = min_t(u8, ioc->cpu_count,
+	ioc->reply_queue_count = min_t(int, ioc->cpu_count,
 	    ioc->msix_vector_count);
 
 	entries = kcalloc(ioc->reply_queue_count, sizeof(struct msix_entry),
-- 
1.7.5.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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux