* [PATCH] [SCSI] mpt2sas: Fix possible integer truncation of cpu_count
@ 2011-12-01 0:30 Roland Dreier
2011-12-02 3:52 ` Nandigama, Nagalakshmi
0 siblings, 1 reply; 2+ messages in thread
From: Roland Dreier @ 2011-12-01 0:30 UTC (permalink / raw)
To: James E.J. Bottomley; +Cc: Nagalakshmi Nandigama, linux-scsi
From: Roland Dreier <roland@purestorage.com>
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@purestorage.com>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [PATCH] [SCSI] mpt2sas: Fix possible integer truncation of cpu_count
2011-12-01 0:30 [PATCH] [SCSI] mpt2sas: Fix possible integer truncation of cpu_count Roland Dreier
@ 2011-12-02 3:52 ` Nandigama, Nagalakshmi
0 siblings, 0 replies; 2+ messages in thread
From: Nandigama, Nagalakshmi @ 2011-12-02 3:52 UTC (permalink / raw)
To: Roland Dreier, James Bottomley; +Cc: linux-scsi@vger.kernel.org
The patch seem to be fine.
Please consider this patch as acked by me.
Regards,
Nagalakshmi
-----Original Message-----
From: Roland Dreier [mailto:roland@purestorage.com] On Behalf Of Roland Dreier
Sent: Thursday, December 01, 2011 6:01 AM
To: James E.J. Bottomley
Cc: Nandigama, Nagalakshmi; linux-scsi@vger.kernel.org
Subject: [PATCH] [SCSI] mpt2sas: Fix possible integer truncation of cpu_count
From: Roland Dreier <roland@purestorage.com>
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@purestorage.com>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-12-02 3:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-01 0:30 [PATCH] [SCSI] mpt2sas: Fix possible integer truncation of cpu_count Roland Dreier
2011-12-02 3:52 ` Nandigama, Nagalakshmi
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).