History

block: use "unsigned long" for blk_validate_block_size().

Since lo_simple_ioctl(LOOP_SET_BLOCK_SIZE) and ioctl(NBD_SET_BLKSIZE) pass user-controlled "unsigned long arg" to blk_validate_block_size(), "unsigned long" should be used for validation.

Tetsuo Handa committed 4 years ago

Commit 37ae5a01 parent 99d86901 file · +1 −1Browse files

Showing the changes to include/linux/blkdev.h (1 of 1 file). Show all

Unified · Split

include/linux/blkdev.h+1−1
@@ -45,7 +45,7 @@ struct blk_crypto_profile; · 44 unmodified lines
45 */45 */
46#define BLKCG_MAX_POLS 646#define BLKCG_MAX_POLS 6
47 47
48static inline int blk_validate_block_size(unsigned int bsize)48static inline int blk_validate_block_size(unsigned long bsize)
49{49{
50 if (bsize < 512 || bsize > PAGE_SIZE || !is_power_of_2(bsize))50 if (bsize < 512 || bsize > PAGE_SIZE || !is_power_of_2(bsize))
51 return -EINVAL;51 return -EINVAL;