Skip to content

Commit b0b4518

Browse files
qianfengrongaxboe
authored andcommitted
block: use int to store blk_stack_limits() return value
Change the 'ret' variable in blk_stack_limits() from unsigned int to int, as it needs to store negative value -1. Storing the negative error codes in unsigned type, or performing equality comparisons (e.g., ret == -1), doesn't cause an issue at runtime [1] but can be confusing. Additionally, assigning negative error codes to unsigned type may trigger a GCC warning when the -Wsign-conversion flag is enabled. No effect on runtime. Link: https://lore.kernel.org/all/x3wogjf6vgpkisdhg3abzrx7v7zktmdnfmqeih5kosszmagqfs@oh3qxrgzkikf/ #1 Signed-off-by: Qianfeng Rong <[email protected]> Reviewed-by: John Garry <[email protected]> Fixes: fe0b393 ("block: Correct handling of bottom device misaligment") Reviewed-by: Bart Van Assche <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 34585dc commit b0b4518

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

block/blk-settings.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,8 @@ static void blk_stack_atomic_writes_limits(struct queue_limits *t,
763763
int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
764764
sector_t start)
765765
{
766-
unsigned int top, bottom, alignment, ret = 0;
766+
unsigned int top, bottom, alignment;
767+
int ret = 0;
767768

768769
t->features |= (b->features & BLK_FEAT_INHERIT_MASK);
769770

0 commit comments

Comments
 (0)