]> git.itanic.dy.fi Git - linux-stable/commitdiff
block: use "unsigned long" for blk_validate_block_size().
authorTetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Sat, 18 Dec 2021 09:41:56 +0000 (18:41 +0900)
committerJens Axboe <axboe@kernel.dk>
Tue, 21 Dec 2021 16:32:57 +0000 (09:32 -0700)
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.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/9ecbf057-4375-c2db-ab53-e4cc0dff953d@i-love.sakura.ne.jp
Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/linux/blkdev.h

index c80cfaefc0a8f6238e67f5213ad1a85700c75ffe..bb5fb7282e6eeb9762003d422e82861bf5f4a7b8 100644 (file)
@@ -45,7 +45,7 @@ struct blk_crypto_profile;
  */
 #define BLKCG_MAX_POLS         6
 
-static inline int blk_validate_block_size(unsigned int bsize)
+static inline int blk_validate_block_size(unsigned long bsize)
 {
        if (bsize < 512 || bsize > PAGE_SIZE || !is_power_of_2(bsize))
                return -EINVAL;