From: Christoph Hellwig Date: Mon, 11 Oct 2021 14:41:37 +0000 (+0200) Subject: block: use bdev_nr_bytes instead of open coding it in blkdev_fallocate X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=c76c4aa1684e5cc1c91b23b5227920c556c363bf;p=users%2Fhch%2Fblock.git block: use bdev_nr_bytes instead of open coding it in blkdev_fallocate Use the proper helper to read the block device size. Signed-off-by: Christoph Hellwig Reviewed-by: Kees Cook Reviewed-by: Jan Kara Reviewed-by: Chaitanya Kulkarni --- diff --git a/block/fops.c b/block/fops.c index 7bb9581a146c..a6a4d412720c 100644 --- a/block/fops.c +++ b/block/fops.c @@ -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) {