kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: megaraid: silence a static checker bug
@ 2018-05-03 10:54 Dan Carpenter
  2018-05-08  5:29 ` Martin K. Petersen
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2018-05-03 10:54 UTC (permalink / raw)
  To: kernel-janitors

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>

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);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] scsi: megaraid: silence a static checker bug
  2018-05-03 10:54 [PATCH] scsi: megaraid: silence a static checker bug Dan Carpenter
@ 2018-05-08  5:29 ` Martin K. Petersen
  0 siblings, 0 replies; 2+ messages in thread
From: Martin K. Petersen @ 2018-05-08  5:29 UTC (permalink / raw)
  To: kernel-janitors


Dan,

> 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!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-05-08  5:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-03 10:54 [PATCH] scsi: megaraid: silence a static checker bug Dan Carpenter
2018-05-08  5:29 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).