diff mbox series

[net-next] ipv4: remove unnecessary judgment in ip_route_output_key_hash_rcu

Message ID 20250401020017.96438-1-shaozhengchao@163.com (mailing list archive)
State Deferred
Delegated to: Netdev Maintainers
Headers show
Series [net-next] ipv4: remove unnecessary judgment in ip_route_output_key_hash_rcu | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2025-04-01--03-00 (tests: 902)

Commit Message

shaozhengchao April 1, 2025, 2 a.m. UTC
From: Zhengchao Shao <shaozhengchao@163.com>

In the ip_route_output_key_cash_rcu function, the input fl4 member saddr is
first checked to be non-zero before entering multicast, broadcast and
arbitrary IP address checks. However, the fact that the IP address is not
0 has already ruled out the possibility of any address, so remove
unnecessary judgment.

Signed-off-by: Zhengchao Shao <shaozhengchao@163.com>
---
 net/ipv4/route.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Paolo Abeni April 1, 2025, 10:36 a.m. UTC | #1
On 4/1/25 4:00 AM, shaozhengchao@163.com wrote:
> From: Zhengchao Shao <shaozhengchao@163.com>
> 
> In the ip_route_output_key_cash_rcu function, the input fl4 member saddr is
> first checked to be non-zero before entering multicast, broadcast and
> arbitrary IP address checks. However, the fact that the IP address is not
> 0 has already ruled out the possibility of any address, so remove
> unnecessary judgment.
> 
> Signed-off-by: Zhengchao Shao <shaozhengchao@163.com>

## Form letter - net-next-closed

Linus already pulled net-next material v6.15 and therefore net-next is
closed for new drivers, features, code refactoring and optimizations. We
are currently accepting bug fixes only.

Please repost when net-next reopens after Apr 7th.

RFC patches sent for review only are obviously welcome at any time.

See:
https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#development-cycle
diff mbox series

Patch

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 753704f75b2c..22dfc971aab4 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2699,8 +2699,7 @@  struct rtable *ip_route_output_key_hash_rcu(struct net *net, struct flowi4 *fl4,
 
 	if (fl4->saddr) {
 		if (ipv4_is_multicast(fl4->saddr) ||
-		    ipv4_is_lbcast(fl4->saddr) ||
-		    ipv4_is_zeronet(fl4->saddr)) {
+		    ipv4_is_lbcast(fl4->saddr)) {
 			rth = ERR_PTR(-EINVAL);
 			goto out;
 		}