From: Zhengchao Shao Date: Wed, 9 Apr 2025 03:33:21 +0000 (+0800) Subject: ipv4: remove unnecessary judgment in ip_route_output_key_hash_rcu X-Git-Tag: v6.16-rc1~132^2~332 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b4f78f9ad292ad57e3db483332ce7bc799d0d49;p=thirdparty%2Fkernel%2Flinux.git ipv4: remove unnecessary judgment in ip_route_output_key_hash_rcu 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 Reviewed-by: David Ahern Link: https://patch.msgid.link/20250409033321.108244-1-shaozhengchao@163.com Signed-off-by: Jakub Kicinski --- diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 753704f75b2c6..22dfc971aab4b 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; }