Message ID | 20220425192740.171756-2-khazhy@google.com |
---|---|
State | New |
Headers | show |
Series | [v5.15] block/compat_ioctl: fix range check in BLKGETSIZE | expand |
diff --git a/block/ioctl.c b/block/ioctl.c index a31be7fa31a5..cd506a902963 100644 --- a/block/ioctl.c +++ b/block/ioctl.c @@ -645,7 +645,7 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg) (bdev->bd_disk->bdi->ra_pages * PAGE_SIZE) / 512); case BLKGETSIZE: size = i_size_read(bdev->bd_inode); - if ((size >> 9) > ~0UL) + if ((size >> 9) > ~(compat_ulong_t)0) return -EFBIG; return compat_put_ulong(argp, size >> 9);