Skip to contentSkip to conversation

Wrong size information for devices with disabled read access

PATCH New Hannes Reinecke 1 participant 1 message Sep 1, 2006 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Wrong size information for devices with disabled read access

Hi James,

when accessing a device with disabled read access the capacity is set somewhat arbitrary to 1GB. This makes it quite impossible for userspace applications to detect this as an invalid capacity.
And it is inconsistent with other error conditions, where the capacity is in fact set to 0.

Please apply.

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke			[email protected]
SuSE Linux Products GmbH		S390 & zSeries
Maxfeldstraße 5				+49 911 74053 688
90409 Nürnberg				http://www.suse.de

Wrong size information for devices with disabled read access

When accessing a device with disabled read access the capacity is set randomly to 1GB. This makes it impossible to userspace tools to detect invalid device capacities.

drivers/scsi/sd.c +1 -1
index 98bd3aa..638cff4 100644
@@ -1215,7 +1215,7 @@ repeat:
 		/* Either no media are present but the drive didn't tell us,
 		   or they are present but the read capacity command fails */
 		/* sdkp->media_present = 0; -- not always correct */
-		sdkp->capacity = 0x200000; /* 1 GB - random */
+		sdkp->capacity = 0; /* unknown mapped to zero - as usual */
 
 		return;
 	} else if (the_result && longrc) {