]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - queue-4.19/ipv4-route-avoid-unused-but-set-variable-warning.patch
6.1-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.19 / ipv4-route-avoid-unused-but-set-variable-warning.patch
CommitLineData
5dd38f29
SL
1From 84b859140a44c03d55b574061ca96804d6e302d5 Mon Sep 17 00:00:00 2001
2From: Sasha Levin <sashal@kernel.org>
3Date: Mon, 8 Apr 2024 09:42:03 +0200
4Subject: ipv4/route: avoid unused-but-set-variable warning
5
6From: Arnd Bergmann <arnd@arndb.de>
7
8[ Upstream commit cf1b7201df59fb936f40f4a807433fe3f2ce310a ]
9
10The log_martians variable is only used in an #ifdef, causing a 'make W=1'
11warning with gcc:
12
13net/ipv4/route.c: In function 'ip_rt_send_redirect':
14net/ipv4/route.c:880:13: error: variable 'log_martians' set but not used [-Werror=unused-but-set-variable]
15
16Change the #ifdef to an equivalent IS_ENABLED() to let the compiler
17see where the variable is used.
18
19Fixes: 30038fc61adf ("net: ip_rt_send_redirect() optimization")
20Reviewed-by: David Ahern <dsahern@kernel.org>
21Signed-off-by: Arnd Bergmann <arnd@arndb.de>
22Reviewed-by: Eric Dumazet <edumazet@google.com>
23Link: https://lore.kernel.org/r/20240408074219.3030256-2-arnd@kernel.org
24Signed-off-by: Paolo Abeni <pabeni@redhat.com>
25Signed-off-by: Sasha Levin <sashal@kernel.org>
26---
27 net/ipv4/route.c | 4 +---
28 1 file changed, 1 insertion(+), 3 deletions(-)
29
30diff --git a/net/ipv4/route.c b/net/ipv4/route.c
31index f4d41ceef9466..3014605105350 100644
32--- a/net/ipv4/route.c
33+++ b/net/ipv4/route.c
34@@ -937,13 +937,11 @@ void ip_rt_send_redirect(struct sk_buff *skb)
35 icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST, gw);
36 peer->rate_last = jiffies;
37 ++peer->n_redirects;
38-#ifdef CONFIG_IP_ROUTE_VERBOSE
39- if (log_martians &&
40+ if (IS_ENABLED(CONFIG_IP_ROUTE_VERBOSE) && log_martians &&
41 peer->n_redirects == ip_rt_redirect_number)
42 net_warn_ratelimited("host %pI4/if%d ignores redirects for %pI4 to %pI4\n",
43 &ip_hdr(skb)->saddr, inet_iif(skb),
44 &ip_hdr(skb)->daddr, &gw);
45-#endif
46 }
47 out_put_peer:
48 inet_putpeer(peer);
49--
502.43.0
51