Skip to contentSkip to conversation

scsi: megaraid: silence a static checker bug

PATCH Applied Dan Carpenter 2 participants 2 messages May 3, 2018 – May 8, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

drivers/scsi/megaraid.c +3 -0
index 7195cff51d4c..9b6f5d024dba 100644
@@ -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);
#1 lore raw

Dan,

Quoted 3 lines

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.

Applied to 4.18/scsi-queue. Thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering