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.
Unified · Split
| @@ -45,7 +45,7 @@ struct blk_crypto_profile; · 44 unmodified lines | |||
| 45 | */ | 45 | */ |
| 46 | #define BLKCG_MAX_POLS 6 | 46 | #define BLKCG_MAX_POLS 6 |
| 47 | 47 | ||
| 48 | static inline int blk_validate_block_size(unsigned int bsize) | 48 | static 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; |