diff options
Diffstat (limited to 'block/compat_ioctl.c')
-rw-r--r-- | block/compat_ioctl.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c index a0926a6094b2..18b282ce361e 100644 --- a/block/compat_ioctl.c +++ b/block/compat_ioctl.c | |||
@@ -663,6 +663,7 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg) | |||
663 | fmode_t mode = file->f_mode; | 663 | fmode_t mode = file->f_mode; |
664 | struct backing_dev_info *bdi; | 664 | struct backing_dev_info *bdi; |
665 | loff_t size; | 665 | loff_t size; |
666 | unsigned int max_sectors; | ||
666 | 667 | ||
667 | /* | 668 | /* |
668 | * O_NDELAY can be altered using fcntl(.., F_SETFL, ..), so we have | 669 | * O_NDELAY can be altered using fcntl(.., F_SETFL, ..), so we have |
@@ -719,8 +720,9 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg) | |||
719 | case BLKSSZGET: /* get block device hardware sector size */ | 720 | case BLKSSZGET: /* get block device hardware sector size */ |
720 | return compat_put_int(arg, bdev_logical_block_size(bdev)); | 721 | return compat_put_int(arg, bdev_logical_block_size(bdev)); |
721 | case BLKSECTGET: | 722 | case BLKSECTGET: |
722 | return compat_put_ushort(arg, | 723 | max_sectors = min_t(unsigned int, USHRT_MAX, |
723 | queue_max_sectors(bdev_get_queue(bdev))); | 724 | queue_max_sectors(bdev_get_queue(bdev))); |
725 | return compat_put_ushort(arg, max_sectors); | ||
724 | case BLKROTATIONAL: | 726 | case BLKROTATIONAL: |
725 | return compat_put_ushort(arg, | 727 | return compat_put_ushort(arg, |
726 | !blk_queue_nonrot(bdev_get_queue(bdev))); | 728 | !blk_queue_nonrot(bdev_get_queue(bdev))); |