Re: Reproducible segmentation faults with 2.1.98

David S. Miller (davem@dm.cobaltmicro.com)
Sat, 25 Apr 1998 16:49:29 -0700


From: "Alfredo Sanjuan" <alfre@ibd.es>
Date: Sat, 25 Apr 1998 22:51:03 +0200

If you do a cat /proc/ide/ide0/config you get every time a
segmentation fault.

But only if your IDE controller is not a PCI one and you have
CONFIG_PCI set in your kernel config ;-) This patch should fix it.

--- drivers/block/ide-proc.c.~1~ Wed Apr 15 22:18:20 1998
+++ drivers/block/ide-proc.c Sat Apr 25 16:48:07 1998
@@ -263,6 +263,8 @@

struct pci_dev *dev = hwif->pci_dev;

+ if(dev == NULL)
+ goto not_pci;
out += sprintf(out, "pci bus %02x device %02x vid %04x did %04x channel %d\n",
dev->bus->number, dev->devfn, hwif->pci_devid.vid, hwif->pci_devid.did, hwif->channel);
do {
@@ -277,9 +279,11 @@
} else
out += sprintf(out, "%02x%c", val, (++reg & 0xf) ? ' ' : '\n');
} while (reg < 0x100);
-#else /* CONFIG_BLK_DEV_IDEPCI */
- out += sprintf(out, "(none)\n");
+ len = out - page;
+ PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
+not_pci:
#endif /* CONFIG_BLK_DEV_IDEPCI */
+ out += sprintf(out, "(none)\n");
len = out - page;
PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu