diff options
-rw-r--r-- | drivers/block/floppy.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index d41d7f018549..3266b4f65daa 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -3497,6 +3497,9 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, ((cmd & 0x80) && !capable(CAP_SYS_ADMIN))) return -EPERM; + if (WARN_ON(size < 0 || size > sizeof(inparam))) + return -EINVAL; + /* copyin */ CLEARSTRUCT(&inparam); if (_IOC_DIR(cmd) & _IOC_WRITE) |