Skip to content

Commit 2a93ad8

Browse files
Christoph Hellwigaxboe
authored andcommitted
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 <[email protected]> Reviewed-by: Kees Cook <[email protected]> Reviewed-by: Jan Kara <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent be9a7b3 commit 2a93ad8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

block/fops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ static long blkdev_fallocate(struct file *file, int mode, loff_t start,
535535
return -EOPNOTSUPP;
536536

537537
/* Don't go off the end of the device. */
538-
isize = i_size_read(bdev->bd_inode);
538+
isize = bdev_nr_bytes(bdev);
539539
if (start >= isize)
540540
return -EINVAL;
541541
if (end >= isize) {

0 commit comments

Comments
 (0)