From: Roland Dreier <roland@kernel.org>
To: "James E.J. Bottomley" <JBottomley@parallels.com>
Cc: Nagalakshmi Nandigama <nagalakshmi.nandigama@lsi.com>,
linux-scsi@vger.kernel.org
Subject: [PATCH] [SCSI] mpt2sas: Fix possible integer truncation of cpu_count
Date: Wed, 30 Nov 2011 16:30:33 -0800 [thread overview]
Message-ID: <1322699433-22886-1-git-send-email-roland@kernel.org> (raw)
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
next reply other threads:[~2011-12-01 0:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-01 0:30 Roland Dreier [this message]
2011-12-02 3:52 ` [PATCH] [SCSI] mpt2sas: Fix possible integer truncation of cpu_count Nandigama, Nagalakshmi
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=1322699433-22886-1-git-send-email-roland@kernel.org \
--to=roland@kernel.org \
--cc=JBottomley@parallels.com \
--cc=linux-scsi@vger.kernel.org \
--cc=nagalakshmi.nandigama@lsi.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.