Commit 7e76336
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: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Coly Li <colyli@kernel.org>
Reviewed-by: Yu Kuai <yukuai3@huawei.com>
Link: https://lore.kernel.org/r/20250309160556.42854-1-colyli@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>1 parent fc0e982 commit 7e76336
1 file changed
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1242 | 1242 | | |
1243 | 1243 | | |
1244 | 1244 | | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
1245 | 1248 | | |
1246 | 1249 | | |
1247 | 1250 | | |
1248 | 1251 | | |
1249 | 1252 | | |
1250 | 1253 | | |
1251 | | - | |
1252 | | - | |
1253 | 1254 | | |
1254 | 1255 | | |
1255 | 1256 | | |
| |||
0 commit comments