summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2018-05-03 13:54:32 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-08-03 08:55:23 +0300
commit749c6f0e3b5d22a50c026c75b06c030650a46af2 (patch)
treedb248165c6a85eebc62c9046e8acf8f6eb513ee5
parent5a644f682267dff1614e5aaf23cdcffeefe91213 (diff)
downloadlinux-749c6f0e3b5d22a50c026c75b06c030650a46af2.tar.xz
scsi: megaraid: silence a static checker bug
[ Upstream commit 27e833dabab74ee665e487e291c9afc6d71effba ] If we had more than 32 megaraid cards then it would cause memory corruption. That's not likely, of course, but it's handy to enforce it and make the static checker happy. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/scsi/megaraid.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 9d05302a3bcd..19bffe0b2cc0 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -4197,6 +4197,9 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
int irq, i, j;
int error = -ENODEV;
+ if (hba_count >= MAX_CONTROLLERS)
+ goto out;
+
if (pci_enable_device(pdev))
goto out;
pci_set_master(pdev);