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
This commit is contained in:
parent
51aa556e27
commit
66f662a622
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user