]> www.infradead.org Git - users/jedix/linux-maple.git/commit
[SCSI] mpt2sas: Fix possible integer truncation of cpu_count
authorRoland Dreier <roland@purestorage.com>
Thu, 1 Dec 2011 00:30:33 +0000 (16:30 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 16 Dec 2011 16:49:35 +0000 (11:49 -0500)
commit67be0eb4cdeb9f6821abdb6c756b440c2ac11530
treeeb906277887eabf4e91dbce4713847468894e1af
parent610edf5aba0ecea77ee431837d1de81f610ecb59
[SCSI] mpt2sas: Fix possible integer truncation of cpu_count

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>
Acked-by: "Nandigama, Nagalakshmi" <Nagalakshmi.Nandigama@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/mpt2sas/mpt2sas_base.c