Skip to content

Commit cf1b720

Browse files
arndbPaolo Abeni
authored and
Paolo Abeni
committed
ipv4/route: avoid unused-but-set-variable warning
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]>
1 parent 7404348 commit cf1b720

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

net/ipv4/route.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -926,13 +926,11 @@ void ip_rt_send_redirect(struct sk_buff *skb)
926926
icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST, gw);
927927
peer->rate_last = jiffies;
928928
++peer->n_redirects;
929-
#ifdef CONFIG_IP_ROUTE_VERBOSE
930-
if (log_martians &&
929+
if (IS_ENABLED(CONFIG_IP_ROUTE_VERBOSE) && log_martians &&
931930
peer->n_redirects == ip_rt_redirect_number)
932931
net_warn_ratelimited("host %pI4/if%d ignores redirects for %pI4 to %pI4\n",
933932
&ip_hdr(skb)->saddr, inet_iif(skb),
934933
&ip_hdr(skb)->daddr, &gw);
935-
#endif
936934
}
937935
out_put_peer:
938936
inet_putpeer(peer);

0 commit comments

Comments
 (0)