diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2014-08-04 14:47:07 +1000 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2014-08-04 14:47:07 +1000 |
commit | 60a9ee5dd62d8a0f2cf16d48ca287fe377f819cd (patch) | |
tree | d765fdc83ee912182ddf725d9abc680d20714f41 /block/compat_ioctl.c | |
parent | 05ffb87bea2cee1c13e1cb4a033ba97ee41dc0ca (diff) | |
parent | a84352f828629cfa1f48185d8b41786468d12f56 (diff) |
Merge remote-tracking branch 'block/for-next'
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) fmode_t mode = file->f_mode; struct backing_dev_info *bdi; loff_t size; + unsigned int max_sectors; /* * 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) case BLKSSZGET: /* get block device hardware sector size */ return compat_put_int(arg, bdev_logical_block_size(bdev)); case BLKSECTGET: - return compat_put_ushort(arg, - queue_max_sectors(bdev_get_queue(bdev))); + max_sectors = min_t(unsigned int, USHRT_MAX, + queue_max_sectors(bdev_get_queue(bdev))); + return compat_put_ushort(arg, max_sectors); case BLKROTATIONAL: return compat_put_ushort(arg, !blk_queue_nonrot(bdev_get_queue(bdev))); |