Skip to content

Commit be9a7b3

Browse files
Christoph Hellwigaxboe
authored andcommitted
squashfs: use bdev_nr_bytes instead of open coding it
Use the proper helper to read the block device size. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Kees Cook <[email protected]> Acked-by: Phillip Lougher <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 1d5dd3b commit be9a7b3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fs/squashfs/super.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
1818

19+
#include <linux/blkdev.h>
1920
#include <linux/fs.h>
2021
#include <linux/fs_context.h>
2122
#include <linux/fs_parser.h>
@@ -179,8 +180,8 @@ static int squashfs_fill_super(struct super_block *sb, struct fs_context *fc)
179180
/* Check the filesystem does not extend beyond the end of the
180181
block device */
181182
msblk->bytes_used = le64_to_cpu(sblk->bytes_used);
182-
if (msblk->bytes_used < 0 || msblk->bytes_used >
183-
i_size_read(sb->s_bdev->bd_inode))
183+
if (msblk->bytes_used < 0 ||
184+
msblk->bytes_used > bdev_nr_bytes(sb->s_bdev))
184185
goto failed_mount;
185186

186187
/* Check block size for sanity */

0 commit comments

Comments
 (0)