* Coverity: zblock_reclaim_block(): Control flow issues
@ 2022-11-17 22:21 coverity-bot
2022-11-18 0:05 ` Gustavo A. R. Silva
0 siblings, 1 reply; 2+ messages in thread
From: coverity-bot @ 2022-11-17 22:21 UTC (permalink / raw)
To: Ananda
Cc: Jonathan Corbet, linux-kernel, Minchan Kim, Ananda Badmaev,
Andrew Morton, Sergey Senozhatsky, linux-mm, linux-doc,
Vitaly Wool, Gustavo A. R. Silva, linux-next, linux-hardening
Hello!
This is an experimental semi-automated report about issues detected by
Coverity from a scan of next-20221117 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan
You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by commits:
Wed Nov 16 16:19:12 2022 -0800
9097e28c25c8 ("mm: add zblock - new allocator for use via zpool API")
Coverity reported the following:
*** CID 1527349: Control flow issues (NO_EFFECT)
mm/zblock.c:412 in zblock_reclaim_block()
406 unsigned long handle, block_type, slot;
407 int ret, i, reclaimed;
408
409 /* start with list storing blocks with the worst compression and try
410 * to evict the first added (oldest) block in this list
411 */
vvv CID 1527349: Control flow issues (NO_EFFECT)
vvv This greater-than-or-equal-to-zero comparison of an unsigned value is always true. "block_type >= 0UL".
412 for (block_type = ARRAY_SIZE(block_desc) - 1; block_type >= 0; --block_type) {
413 list = &(pool->block_lists[block_type]);
414 spin_lock(&list->lock);
415
416 /* find the oldest block in list */
417 block = list_last_entry(&list->head, struct zblock_block, block_node);
If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):
Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 1527349 ("Control flow issues")
Fixes: 9097e28c25c8 ("mm: add zblock - new allocator for use via zpool API")
Thanks for your attention!
--
Coverity-bot
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: Coverity: zblock_reclaim_block(): Control flow issues
2022-11-17 22:21 Coverity: zblock_reclaim_block(): Control flow issues coverity-bot
@ 2022-11-18 0:05 ` Gustavo A. R. Silva
0 siblings, 0 replies; 2+ messages in thread
From: Gustavo A. R. Silva @ 2022-11-18 0:05 UTC (permalink / raw)
To: coverity-bot
Cc: Ananda, Jonathan Corbet, linux-kernel, Minchan Kim, Andrew Morton,
Sergey Senozhatsky, linux-mm, linux-doc, Vitaly Wool,
Gustavo A. R. Silva, linux-next, linux-hardening
On Thu, Nov 17, 2022 at 02:21:46PM -0800, coverity-bot wrote:
> Hello!
>
> This is an experimental semi-automated report about issues detected by
> Coverity from a scan of next-20221117 as part of the linux-next scan project:
> https://scan.coverity.com/projects/linux-next-weekly-scan
>
> You're getting this email because you were associated with the identified
> lines of code (noted below) that were touched by commits:
>
> Wed Nov 16 16:19:12 2022 -0800
> 9097e28c25c8 ("mm: add zblock - new allocator for use via zpool API")
>
> Coverity reported the following:
>
> *** CID 1527349: Control flow issues (NO_EFFECT)
> mm/zblock.c:412 in zblock_reclaim_block()
> 406 unsigned long handle, block_type, slot;
> 407 int ret, i, reclaimed;
> 408
> 409 /* start with list storing blocks with the worst compression and try
> 410 * to evict the first added (oldest) block in this list
> 411 */
> vvv CID 1527349: Control flow issues (NO_EFFECT)
> vvv This greater-than-or-equal-to-zero comparison of an unsigned value is always true. "block_type >= 0UL".
> 412 for (block_type = ARRAY_SIZE(block_desc) - 1; block_type >= 0; --block_type) {
This seems like a legit issue.
--
Gustavo
> 413 list = &(pool->block_lists[block_type]);
> 414 spin_lock(&list->lock);
> 415
> 416 /* find the oldest block in list */
> 417 block = list_last_entry(&list->head, struct zblock_block, block_node);
>
> If this is a false positive, please let us know so we can mark it as
> such, or teach the Coverity rules to be smarter. If not, please make
> sure fixes get into linux-next. :) For patches fixing this, please
> include these lines (but double-check the "Fixes" first):
>
> Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
> Addresses-Coverity-ID: 1527349 ("Control flow issues")
> Fixes: 9097e28c25c8 ("mm: add zblock - new allocator for use via zpool API")
>
> Thanks for your attention!
>
> --
> Coverity-bot
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-18 0:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-17 22:21 Coverity: zblock_reclaim_block(): Control flow issues coverity-bot
2022-11-18 0:05 ` Gustavo A. R. Silva
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.