diff options
author | Luis Chamberlain <mcgrof@kernel.org> | 2024-12-18 03:02:11 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2024-12-18 15:22:30 +0100 |
commit | 26fff8a4432ffd03409346b7dae1e1a2c5318b7c (patch) | |
tree | 4b7f2e0fbd8786059558f194e13bb19b25d7bb40 /block | |
parent | block: Fix potential deadlock while freezing queue and acquiring sysfs_lock (diff) | |
download | linux-26fff8a4432ffd03409346b7dae1e1a2c5318b7c.tar.xz linux-26fff8a4432ffd03409346b7dae1e1a2c5318b7c.zip |
block/bdev: use helper for max block size check
We already have a helper for checking the limits on the block size
both low and high, just use that.
No functional changes.
Reviewed-by: John Garry <john.g.garry@oracle.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20241218020212.3657139-2-mcgrof@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r-- | block/bdev.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/block/bdev.c b/block/bdev.c index 738e3c8457e7..9d73a8fbf7f9 100644 --- a/block/bdev.c +++ b/block/bdev.c @@ -155,8 +155,7 @@ int set_blocksize(struct file *file, int size) struct inode *inode = file->f_mapping->host; struct block_device *bdev = I_BDEV(inode); - /* Size must be a power of two, and between 512 and PAGE_SIZE */ - if (size > PAGE_SIZE || size < 512 || !is_power_of_2(size)) + if (blk_validate_block_size(size)) return -EINVAL; /* Size cannot be smaller than the size supported by the device */ |