public inbox for netfilter-devel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org
Subject: [bug report] netfilter: nf_tables: nft_set_rbtree: fix spurious insertion failure
Date: Fri, 10 Apr 2026 13:35:22 +0300	[thread overview]
Message-ID: <adjSaolTji0mPgqx@stanley.mountain> (raw)

Hello Florian Westphal,

Commit 087388278e0f ("netfilter: nf_tables: nft_set_rbtree: fix
spurious insertion failure") from Sep 28, 2023 (linux-next), leads to
the following Smatch static checker warning:

	net/netfilter/nft_set_rbtree.c:399 __nft_rbtree_insert()
	warn: 'removed_end' is not an error pointer

net/netfilter/nft_set_rbtree.c
    379         /* Detect overlap by going through the list of valid tree nodes.
    380          * Values stored in the tree are in reversed order, starting from
    381          * highest to lowest value.
    382          */
    383         for (node = first; node != NULL; node = next) {
    384                 next = rb_next(node);
    385 
    386                 rbe = rb_entry(node, struct nft_rbtree_elem, node);
    387 
    388                 if (!nft_set_elem_active(&rbe->ext, genmask))
    389                         continue;
    390 
    391                 /* perform garbage collection to avoid bogus overlap reports
    392                  * but skip new elements in this transaction.
    393                  */
    394                 if (__nft_set_elem_expired(&rbe->ext, tstamp) &&
    395                     nft_set_elem_active(&rbe->ext, cur_genmask)) {
    396                         const struct nft_rbtree_elem *removed_end;
    397 
    398                         removed_end = nft_rbtree_gc_elem(set, priv, rbe);
--> 399                         if (IS_ERR(removed_end))
    400                                 return PTR_ERR(removed_end);

nft_rbtree_gc_elem() returns NULL, not error pointers.

    401 
    402                         if (removed_end == rbe_le || removed_end == rbe_ge)
    403                                 return -EAGAIN;
    404 
    405                         continue;
    406                 }

This email is a free service from the Smatch-CI project [smatch.sf.net].

regards,
dan carpenter

                 reply	other threads:[~2026-04-10 10:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=adjSaolTji0mPgqx@stanley.mountain \
    --to=error27@gmail.com \
    --cc=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    /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