summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/megaraid.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2018-05-03 12:54:32 +0200
committerMartin K. Petersen <martin.petersen@oracle.com>2018-05-08 07:29:00 +0200
commit27e833dabab74ee665e487e291c9afc6d71effba (patch)
tree04dbc98b1e0427ad9da8da67d5f1464b39e8a307 /drivers/scsi/megaraid.c
parentscsi: mptsas: fix spelling mistake: "matchs" -> "matches" (diff)
downloadlinux-27e833dabab74ee665e487e291c9afc6d71effba.tar.xz
linux-27e833dabab74ee665e487e291c9afc6d71effba.zip
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);