]> www.infradead.org Git - users/hch/block.git/commitdiff
block: use bdev_nr_bytes instead of open coding it in blkdev_fallocate
authorChristoph Hellwig <hch@lst.de>
Mon, 11 Oct 2021 14:41:37 +0000 (16:41 +0200)
committerChristoph Hellwig <hch@lst.de>
Mon, 18 Oct 2021 04:56:21 +0000 (06:56 +0200)
Use the proper helper to read the block device size.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
block/fops.c

index 7bb9581a146cff0b184c009ba5b1c7c2915925e0..a6a4d412720cdf4b69b9af9b57a535e7551cd3a8 100644 (file)
@@ -548,7 +548,7 @@ static long blkdev_fallocate(struct file *file, int mode, loff_t start,
                return -EOPNOTSUPP;
 
        /* Don't go off the end of the device. */
-       isize = i_size_read(bdev->bd_inode);
+       isize = bdev_nr_bytes(bdev);
        if (start >= isize)
                return -EINVAL;
        if (end >= isize) {