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 --- 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