Commit 7e76336e authored by Coly Li's avatar Coly Li Committed by Jens Axboe
Browse files

badblocks: Fix a nonsense WARN_ON() which checks whether a u64 variable < 0



In _badblocks_check(), there are lines of code like this,
1246         sectors -= len;
[snipped]
1251         WARN_ON(sectors < 0);

The WARN_ON() at line 1257 doesn't make sense because sectors is
unsigned long long type and never to be <0.

Fix it by checking directly checking whether sectors is less than len.

Reported-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: default avatarColy Li <colyli@kernel.org>
Reviewed-by: default avatarYu Kuai <yukuai3@huawei.com>
Link: https://lore.kernel.org/r/20250309160556.42854-1-colyli@kernel.org


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent fc0e982b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment