netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipv4/route: avoid unused-but-set-variable warning
@ 2024-03-22 13:18 Arnd Bergmann
  2024-03-22 13:26 ` Simon Horman
  2024-03-22 15:10 ` David Ahern
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2024-03-22 13:18 UTC (permalink / raw)
  To: David S. Miller, David Ahern, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni
  Cc: Arnd Bergmann, Kunwu Chan, Joel Granados, Zhengchao Shao,
	Wangyang Guo, Kyle Zeng, Beniamino Galvani, netdev, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

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: 30038fc61adf ("net: ip_rt_send_redirect() optimization")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 net/ipv4/route.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index c8f76f56dc16..d36ace160d42 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -926,13 +926,11 @@ void ip_rt_send_redirect(struct sk_buff *skb)
 		icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST, gw);
 		peer->rate_last = jiffies;
 		++peer->n_redirects;
-#ifdef CONFIG_IP_ROUTE_VERBOSE
-		if (log_martians &&
+		if (IS_ENABLED(CONFIG_IP_ROUTE_VERBOSE) && log_martians &&
 		    peer->n_redirects == ip_rt_redirect_number)
 			net_warn_ratelimited("host %pI4/if%d ignores redirects for %pI4 to %pI4\n",
 					     &ip_hdr(skb)->saddr, inet_iif(skb),
 					     &ip_hdr(skb)->daddr, &gw);
-#endif
 	}
 out_put_peer:
 	inet_putpeer(peer);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ipv4/route: avoid unused-but-set-variable warning
  2024-03-22 13:18 [PATCH] ipv4/route: avoid unused-but-set-variable warning Arnd Bergmann
@ 2024-03-22 13:26 ` Simon Horman
  2024-03-22 15:10 ` David Ahern
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2024-03-22 13:26 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: David S. Miller, David Ahern, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Arnd Bergmann, Kunwu Chan, Joel Granados,
	Zhengchao Shao, Wangyang Guo, Kyle Zeng, Beniamino Galvani,
	netdev, linux-kernel

On Fri, Mar 22, 2024 at 02:18:12PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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: 30038fc61adf ("net: ip_rt_send_redirect() optimization")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

## Form letter - net-next-closed

(text from Jakub)

The merge window for v6.9 has begun and therefore net-next is closed
for new drivers, features, code refactoring and optimizations.
We are currently accepting bug fixes only.

Please repost when net-next reopens after March 25th.

RFC patches sent for review only are welcome at any time.

See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#development-cycle
--
pw-bot: defer

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ipv4/route: avoid unused-but-set-variable warning
  2024-03-22 13:18 [PATCH] ipv4/route: avoid unused-but-set-variable warning Arnd Bergmann
  2024-03-22 13:26 ` Simon Horman
@ 2024-03-22 15:10 ` David Ahern
  1 sibling, 0 replies; 3+ messages in thread
From: David Ahern @ 2024-03-22 15:10 UTC (permalink / raw)
  To: Arnd Bergmann, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni
  Cc: Arnd Bergmann, Kunwu Chan, Joel Granados, Zhengchao Shao,
	Wangyang Guo, Kyle Zeng, Beniamino Galvani, netdev, linux-kernel

On 3/22/24 7:18 AM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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: 30038fc61adf ("net: ip_rt_send_redirect() optimization")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  net/ipv4/route.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 

Reviewed-by: David Ahern <dsahern@kernel.org>



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-03-22 15:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-22 13:18 [PATCH] ipv4/route: avoid unused-but-set-variable warning Arnd Bergmann
2024-03-22 13:26 ` Simon Horman
2024-03-22 15:10 ` David Ahern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).