From 2635120eda9b269226d155883a76c5317df9ae55 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Sun, 28 Mar 2004 22:51:01 -0800 Subject: [PATCH] [PATCH] cciss: return -ENXIO on no-device-present From: mike.miller@hp.com If no device is attached we now return -ENXIO instead of some bogus numbers. Prevents applications from trying to access non-existent disks. Also adds HDIO_GETGEO_BIG IOCTL that fdisk uses. --- drivers/block/cciss.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 74aa58bf101f1..8400d564e41f3 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c @@ -469,11 +469,8 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, driver_geo.heads = drv->heads; driver_geo.sectors = drv->sectors; driver_geo.cylinders = drv->cylinders; - } else { - driver_geo.heads = 0xff; - driver_geo.sectors = 0x3f; - driver_geo.cylinders = (int)drv->nr_blocks / (0xff*0x3f); - } + } else + return -ENXIO; driver_geo.start= get_start_sect(inode->i_bdev); if (copy_to_user((void *) arg, &driver_geo, sizeof( struct hd_geometry))) -- 2.53.0