summaryrefslogtreecommitdiffstats
path: root/sys/geom
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2010-04-15 08:39:56 +0000
committeravg <avg@FreeBSD.org>2010-04-15 08:39:56 +0000
commitd77d0a6e95f230df81bdb1f82710a032a210d6a0 (patch)
tree2432dfe0ad5aa8539685e8bcda5c2da942326a4b /sys/geom
parent0531c74881a9fc33b22c265e562f989e60e764e8 (diff)
downloadFreeBSD-src-d77d0a6e95f230df81bdb1f82710a032a210d6a0.zip
FreeBSD-src-d77d0a6e95f230df81bdb1f82710a032a210d6a0.tar.gz
g_io_check: respond to zero pp->mediasize with ENXIO
Previsouly this condition was reported with EIO by bio_offset > mediasize check. Perhaps that check should be extended to bio_offset+bio_length > mediasize. MFC after: 1 week
Diffstat (limited to 'sys/geom')
-rw-r--r--sys/geom/geom_io.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/geom/geom_io.c b/sys/geom/geom_io.c
index 931b7c3..1090c0b 100644
--- a/sys/geom/geom_io.c
+++ b/sys/geom/geom_io.c
@@ -309,8 +309,8 @@ g_io_check(struct bio *bp)
case BIO_READ:
case BIO_WRITE:
case BIO_DELETE:
- /* Zero sectorsize is a probably lack of media */
- if (pp->sectorsize == 0)
+ /* Zero sectorsize or mediasize is probably a lack of media. */
+ if (pp->sectorsize == 0 || pp->mediasize == 0)
return (ENXIO);
/* Reject I/O not on sector boundary */
if (bp->bio_offset % pp->sectorsize)
OpenPOWER on IntegriCloud