Skip to content

Commit 9e55a65

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 1afc86b commit 9e55a65

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
@@ -955,13 +955,11 @@ void ip_rt_send_redirect(struct sk_buff *skb)
955955
icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST, gw);
956956
peer->rate_last = jiffies;
957957
++peer->n_redirects;
958-
#ifdef CONFIG_IP_ROUTE_VERBOSE
959-
if (log_martians &&
958+
if (IS_ENABLED(CONFIG_IP_ROUTE_VERBOSE) && log_martians &&
960959
peer->n_redirects == ip_rt_redirect_number)
961960
net_warn_ratelimited("host %pI4/if%d ignores redirects for %pI4 to %pI4\n",
962961
&ip_hdr(skb)->saddr, inet_iif(skb),
963962
&ip_hdr(skb)->daddr, &gw);
964-
#endif
965963
}
966964
out_put_peer:
967965
inet_putpeer(peer);

0 commit comments

Comments
 (0)