cciss updates [2 of 2]

From: mikem
Date: Thu Mar 25 2004 - 10:29:30 EST


Please consider this for inclusion in the 2.4 kernel.

If no device is attached we now return -ENXIO instead of some bogus numbers.
Prevents applications from trying to access non-existent disks.

cciss.c | 16 ++++------------
1 files changed, 4 insertions(+), 12 deletions(-)
-------------------------------------------------------------------------------
diff -burpN lx2425.orig/drivers/block/cciss.c lx2425-hazard-fix/drivers/block/cciss.c
--- lx2425.orig/drivers/block/cciss.c 2004-03-04 10:16:16.000000000 -0600
+++ lx2425-hazard-fix/drivers/block/cciss.c 2004-03-25 08:52:07.000000000 -0600
@@ -508,12 +508,8 @@ static int cciss_ioctl(struct inode *ino
driver_geo.heads = hba[ctlr]->drv[dsk].heads;
driver_geo.sectors = hba[ctlr]->drv[dsk].sectors;
driver_geo.cylinders = hba[ctlr]->drv[dsk].cylinders;
- } else {
- driver_geo.heads = 0xff;
- driver_geo.sectors = 0x3f;
- driver_geo.cylinders =
- hba[ctlr]->drv[dsk].nr_blocks / (0xff*0x3f);
- }
+ } else
+ return -ENXIO;
driver_geo.start=
hba[ctlr]->hd[MINOR(inode->i_rdev)].start_sect;
if (copy_to_user((void *) arg, &driver_geo,
@@ -528,12 +524,8 @@ static int cciss_ioctl(struct inode *ino
driver_geo.heads = hba[ctlr]->drv[dsk].heads;
driver_geo.sectors = hba[ctlr]->drv[dsk].sectors;
driver_geo.cylinders = hba[ctlr]->drv[dsk].cylinders;
- } else {
- driver_geo.heads = 0xff;
- driver_geo.sectors = 0x3f;
- driver_geo.cylinders =
- hba[ctlr]->drv[dsk].nr_blocks / (0xff*0x3f);
- }
+ } else
+ return -ENXIO;
driver_geo.start=
hba[ctlr]->hd[MINOR(inode->i_rdev)].start_sect;
if (copy_to_user((void *) arg, &driver_geo,
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/