From 16715550feb896067da733edbe8f7020f46cf8d0 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Tue, 21 Oct 2003 18:19:41 -0700 Subject: [PATCH] [PATCH] atp870u oops fix This driver is taking uinitialised stack gunk from the pdev[] array and feeding it into pci_read_config_byte() and crashing when modprobed with no hardware present. Fix it to not index past the initialised members of pdev[]. We don't know if this driver works. --- drivers/scsi/atp870u.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c index 8a1d588d3b6d..b8058fa52808 100644 --- a/drivers/scsi/atp870u.c +++ b/drivers/scsi/atp870u.c @@ -2335,11 +2335,8 @@ static int atp870u_detect(Scsi_Host_Template * tpnt) break; } } - for (h = 0; h < MAX_ATP; h++) { + for (h = 0; h < card; h++) { struct atp_unit tmp, *dev; - if (pdev[h] == NULL) { - return count; - } /* Found an atp870u/w. */ base_io = pci_resource_start(pdev[h], 0); -- 2.39.5