summaryrefslogtreecommitdiffstats
path: root/sys/isa
diff options
context:
space:
mode:
authoryar <yar@FreeBSD.org>2003-06-15 16:18:58 +0000
committeryar <yar@FreeBSD.org>2003-06-15 16:18:58 +0000
commit66f662a622976cb236f15dc6c2767c396daa7c1d (patch)
tree9b247ad85f6cc3a24ebbe7a8cbda9441fb14aadd /sys/isa
parent51aa556e270fbb206f8f6dcb0700585c15baefb5 (diff)
downloadFreeBSD-src-66f662a622976cb236f15dc6c2767c396daa7c1d.zip
FreeBSD-src-66f662a622976cb236f15dc6c2767c396daa7c1d.tar.gz
Check whether the floppy type pointer has been set before trying
to access floppy parameters through it. Note: The DIOCGSECTORSIZE and DIOCGMEDIASIZE handlers withing fdioctl() couldn't be just moved to below the existing check for blocking mode because fd->ft can be non-NULL while still in non-blocking mode (fd->ft can be set with the FD_STYPE ioctl.) PR: kern/52338 No MFC: Not applicable to STABLE
Diffstat (limited to 'sys/isa')
-rw-r--r--sys/isa/fd.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/isa/fd.c b/sys/isa/fd.c
index f4068ef..b6ec2c3 100644
--- a/sys/isa/fd.c
+++ b/sys/isa/fd.c
@@ -2622,10 +2622,14 @@ fdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td)
switch (cmd) {
case DIOCGMEDIASIZE:
+ if (fd->ft == 0)
+ return ((fd->flags & FD_NONBLOCK) ? EAGAIN : ENXIO);
*(off_t *)addr = (128 << (fd->ft->secsize)) * fd->ft->size;
return (0);
case DIOCGSECTORSIZE:
+ if (fd->ft == 0)
+ return ((fd->flags & FD_NONBLOCK) ? EAGAIN : ENXIO);
*(u_int *)addr = 128 << (fd->ft->secsize);
return (0);
OpenPOWER on IntegriCloud