linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavoars@kernel.org>
To: coverity-bot <keescook@chromium.org>
Cc: Ananda <a.badmaev@clicknet.pro>, Jonathan Corbet <corbet@lwn.net>,
	linux-kernel@vger.kernel.org, Minchan Kim <minchan@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	linux-mm@kvack.org, linux-doc@vger.kernel.org,
	Vitaly Wool <vitaly.wool@konsulko.com>,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	linux-next@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: Coverity: zblock_reclaim_block(): Control flow issues
Date: Thu, 17 Nov 2022 18:05:32 -0600	[thread overview]
Message-ID: <Y3bMTK+558whA1VX@work> (raw)
In-Reply-To: <202211171421.914F0F3719@keescook>

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


      reply	other threads:[~2022-11-18  0:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-17 22:21 coverity-bot
2022-11-18  0:05 ` Gustavo A. R. Silva [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y3bMTK+558whA1VX@work \
    --to=gustavoars@kernel.org \
    --cc=a.badmaev@clicknet.pro \
    --cc=akpm@linux-foundation.org \
    --cc=corbet@lwn.net \
    --cc=gustavo@embeddedor.com \
    --cc=keescook@chromium.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-next@vger.kernel.org \
    --cc=minchan@kernel.org \
    --cc=senozhatsky@chromium.org \
    --cc=vitaly.wool@konsulko.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox