summaryrefslogtreecommitdiff
path: root/drivers/scsi/megaraid.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2018-05-03 13:54:32 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2018-05-08 08:29:00 +0300
commit27e833dabab74ee665e487e291c9afc6d71effba (patch)
tree04dbc98b1e0427ad9da8da67d5f1464b39e8a307 /drivers/scsi/megaraid.c
parentc09a21d8ddaf82adc41adc55442bed1852db6249 (diff)
downloadlinux-27e833dabab74ee665e487e291c9afc6d71effba.tar.xz
scsi: megaraid: silence a static checker bug
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>
Diffstat (limited to 'drivers/scsi/megaraid.c')
-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 7195cff51d4c..9b6f5d024dba 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -4199,6 +4199,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);