Skip to content

Commit bdb4361

Browse files
qianfengrongUlrich Hecht
authored andcommitted
block: use int to store blk_stack_limits() return value
[ Upstream commit b0b4518c992eb5f316c6e40ff186cbb7a5009518 ] 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 <rongqianfeng@vivo.com> Reviewed-by: John Garry <john.g.garry@oracle.com> Fixes: fe0b393 ("block: Correct handling of bottom device misaligment") Reviewed-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20250902130930.68317-1-rongqianfeng@vivo.com Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Ulrich Hecht <uli@kernel.org>
1 parent 5e6672c commit bdb4361

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

block/blk-settings.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,8 @@ EXPORT_SYMBOL(blk_queue_stack_limits);
556556
int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
557557
sector_t start)
558558
{
559-
unsigned int top, bottom, alignment, ret = 0;
559+
unsigned int top, bottom, alignment;
560+
int ret = 0;
560561

561562
t->max_sectors = min_not_zero(t->max_sectors, b->max_sectors);
562563
t->max_hw_sectors = min_not_zero(t->max_hw_sectors, b->max_hw_sectors);

0 commit comments

Comments
 (0)