diff mbox series

[v2] block: use "unsigned long" for blk_validate_block_size().

Message ID 9ecbf057-4375-c2db-ab53-e4cc0dff953d@i-love.sakura.ne.jp (mailing list archive)
State New, archived
Headers show
Series [v2] block: use "unsigned long" for blk_validate_block_size(). | expand

Commit Message

Tetsuo Handa Dec. 18, 2021, 9:41 a.m. UTC
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>
---
Changes in v2:
  Rewrite description.

 include/linux/blkdev.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christoph Hellwig Dec. 21, 2021, 4:20 p.m. UTC | #1
Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
Jens Axboe Dec. 21, 2021, 4:33 p.m. UTC | #2
On Sat, 18 Dec 2021 18:41:56 +0900, Tetsuo Handa wrote:
> 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.
> 
> 

Applied, thanks!

[1/1] block: use "unsigned long" for blk_validate_block_size().
      commit: 37ae5a0f5287a52cf51242e76ccf198d02ffe495

Best regards,
diff mbox series

Patch

diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index bd4370baccca..e13e41f7fad2 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -44,7 +44,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;