diff options
| author | Qianfeng Rong <rongqianfeng@vivo.com> | 2025-09-02 21:09:30 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-10-29 13:59:46 +0100 |
| commit | 48d6e1424cb1ebac1f56d53dc0f278213f18c587 (patch) | |
| tree | 7c4187c7ca8c49cb97c671f8af9097fe43cdb6a7 /block | |
| parent | a8c53553f1833cc2d14175d2d72cf37193a01898 (diff) | |
| download | linux-48d6e1424cb1ebac1f56d53dc0f278213f18c587.tar.gz linux-48d6e1424cb1ebac1f56d53dc0f278213f18c587.tar.bz2 linux-48d6e1424cb1ebac1f56d53dc0f278213f18c587.zip | |
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: fe0b393f2c0a ("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>
Diffstat (limited to 'block')
| -rw-r--r-- | block/blk-settings.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/block/blk-settings.c b/block/blk-settings.c index 13be635300a8..d4870441a38a 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c @@ -505,7 +505,8 @@ static unsigned int blk_round_down_sectors(unsigned int sectors, unsigned int lb int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, sector_t start) { - unsigned int top, bottom, alignment, ret = 0; + unsigned int top, bottom, alignment; + int ret = 0; t->max_sectors = min_not_zero(t->max_sectors, b->max_sectors); t->max_hw_sectors = min_not_zero(t->max_hw_sectors, b->max_hw_sectors); |
