Skip to contentSkip to conversation

PATCH [2.4.0test10]: Kiobuf#05, -ENXIO beyond device EOF

DISCUSSION Stephen C. Tweedie 1 participant 1 message Nov 2, 2000

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

Final pending kiobuf fix for now: return ENXIO on requests for non-zero data reads/writes beyond the end of a block device, consistent with SU's

[ENXIO]
A request was made of a non-existent device, or the request was outside the capabilities of the device.

I've had this requested from other vendors who expect this behaviour on raw devices, so it seems to be the accepted behaviour.

Return success on zero-byte requests --- SU and POSIX are picky about that.

--Stephen

drivers/char/raw.c +5 -1
diff -ru linux-2.4.0-test10.kio.04/drivers/char/raw.c linux-2.4.0-test10.kio.05/drivers/char/raw.c
@@ -277,8 +277,12 @@
 	
 	if ((*offp & sector_mask) || (size & sector_mask))
 		return -EINVAL;
-	if ((*offp >> sector_bits) > limit)
+	if ((*offp >> sector_bits) >= limit) {
+		if (size) {
+			return -ENXIO;
+		}
 		return 0;
+	}
 
 	/* 
 	 * We'll just use one kiobuf