From: Nikolay Borisov <nik.borisov@suse.com>
To: davem@davemloft.net
Cc: kuba@kernel.org, dsahern@kernel.org, netdev@vger.kernel.org,
Nikolay Borisov <nik.borisov@suse.com>
Subject: [PATCH] ipv4: fib_rules: Switch to using a for loop in fib_empty_table
Date: Fri, 20 Nov 2026 10:12:42 +0200 [thread overview]
Message-ID: <20261120081242.318541-1-nik.borisov@suse.com> (raw)
Since commit efdfb1e27a33 ("ipv4: fib: bound automatic table ID allocation")
added a sane bound to the loop looking for a table id the concerns in
58075ff523af ("ipv4: fib_rules: Fix possible infinite loop in fib_empty_table")
are rendered moot. Just revert the code back to a "for" loop, using the
new bound. This makes the code's flow and terminating condition a
lot clearer.
No functional changes
Signed-off-by: Nikolay Borisov <nik.borisov@suse.com>
---
net/ipv4/fib_rules.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
index 060501b376a8..7fe3ec07618a 100644
--- a/net/ipv4/fib_rules.c
+++ b/net/ipv4/fib_rules.c
@@ -218,15 +218,9 @@ INDIRECT_CALLABLE_SCOPE int fib4_rule_match(struct fib_rule *rule,
static struct fib_table *fib_empty_table(struct net *net)
{
- u32 id = 1;
-
- while (1) {
+ for (int id = 1; id <= FIB_MAX_AUTO_TABLE_ID; id++)
if (!fib_get_table(net, id))
return fib_new_table(net, id);
-
- if (id++ == FIB_MAX_AUTO_TABLE_ID)
- break;
- }
return NULL;
}
--
2.56.0
next reply other threads:[~2026-11-20 8:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 8:12 Nikolay Borisov [this message]
2026-11-24 11:03 ` [PATCH] ipv4: fib_rules: Switch to using a for loop in fib_empty_table Ido Schimmel
2026-11-24 11:11 ` Nikolay Borisov
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=20261120081242.318541-1-nik.borisov@suse.com \
--to=nik.borisov@suse.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@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