[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git-commits-24
Subject:    [PATCH] cciss update: If no device attached we return -ENXIO instead of some bogus numbers
From:       Linux Kernel Mailing List <linux-kernel () vger ! kernel ! org>
Date:       2004-03-30 17:02:47
Message-ID: 200403301803.i2UI3HNd009158 () hera ! kernel ! org
[Download RAW message or body]

ChangeSet 1.1338, 2004/03/30 14:02:47-03:00, mikem@beardog.cca.cpqcorp.net

	[PATCH] cciss update: If no device attached we return -ENXIO instead of some bogus numbers
	
	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(-)


# This patch includes the following deltas:
#	           ChangeSet	1.1337  -> 1.1338 
#	drivers/block/cciss.c	1.44    -> 1.45   
#

 cciss.c |   16 ++++------------
 1 files changed, 4 insertions(+), 12 deletions(-)


diff -Nru a/drivers/block/cciss.c b/drivers/block/cciss.c
--- a/drivers/block/cciss.c	Tue Mar 30 10:03:18 2004
+++ b/drivers/block/cciss.c	Tue Mar 30 10:03:18 2004
@@ -508,12 +508,8 @@
 			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 @@
 			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 bk-commits-24" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic