Skip to content

Commit 3af3f21

Browse files
arndbgregkh
authored andcommitted
ipv4/route: avoid unused-but-set-variable warning
[ Upstream commit cf1b720 ] The log_martians variable is only used in an #ifdef, causing a 'make W=1' warning with gcc: net/ipv4/route.c: In function 'ip_rt_send_redirect': net/ipv4/route.c:880:13: error: variable 'log_martians' set but not used [-Werror=unused-but-set-variable] Change the #ifdef to an equivalent IS_ENABLED() to let the compiler see where the variable is used. Fixes: 30038fc ("net: ip_rt_send_redirect() optimization") Reviewed-by: David Ahern <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent e9f4cfe commit 3af3f21

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

net/ipv4/route.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -945,13 +945,11 @@ void ip_rt_send_redirect(struct sk_buff *skb)
945945
icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST, gw);
946946
peer->rate_last = jiffies;
947947
++peer->n_redirects;
948-
#ifdef CONFIG_IP_ROUTE_VERBOSE
949-
if (log_martians &&
948+
if (IS_ENABLED(CONFIG_IP_ROUTE_VERBOSE) && log_martians &&
950949
peer->n_redirects == ip_rt_redirect_number)
951950
net_warn_ratelimited("host %pI4/if%d ignores redirects for %pI4 to %pI4\n",
952951
&ip_hdr(skb)->saddr, inet_iif(skb),
953952
&ip_hdr(skb)->daddr, &gw);
954-
#endif
955953
}
956954
out_put_peer:
957955
inet_putpeer(peer);

0 commit comments

Comments
 (0)