netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] rxrpc: Fix missing IPV6 #ifdef
@ 2022-11-10  9:43 David Howells
  2022-11-10 10:42 ` Hideaki Yoshifuji
  2022-11-10 13:47 ` Andrew Lunn
  0 siblings, 2 replies; 6+ messages in thread
From: David Howells @ 2022-11-10  9:43 UTC (permalink / raw)
  To: netdev; +Cc: kernel test robot, Marc Dionne, linux-afs, dhowells, linux-kernel

Fix rxrpc_encap_err_rcv() to make the call to ipv6_icmp_error conditional
on IPV6 support being enabled.

Fixes: b6c66c4324e7 ("rxrpc: Use the core ICMP/ICMP6 parsers")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
cc: netdev@vger.kernel.org
---

 net/rxrpc/local_object.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/rxrpc/local_object.c b/net/rxrpc/local_object.c
index a178f71e5082..25cdfcf7b415 100644
--- a/net/rxrpc/local_object.c
+++ b/net/rxrpc/local_object.c
@@ -33,7 +33,9 @@ static void rxrpc_encap_err_rcv(struct sock *sk, struct sk_buff *skb, int err,
 {
 	if (ip_hdr(skb)->version == IPVERSION)
 		return ip_icmp_error(sk, skb, err, port, info, payload);
+#ifdef CONFIG_AF_RXRPC_IPV6
 	return ipv6_icmp_error(sk, skb, err, port, info, payload);
+#endif
 }
 
 /*



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

* Re: [PATCH net-next] rxrpc: Fix missing IPV6 #ifdef
  2022-11-10  9:43 [PATCH net-next] rxrpc: Fix missing IPV6 #ifdef David Howells
@ 2022-11-10 10:42 ` Hideaki Yoshifuji
  2022-11-10 13:26   ` David Howells
  2022-11-10 13:47 ` Andrew Lunn
  1 sibling, 1 reply; 6+ messages in thread
From: Hideaki Yoshifuji @ 2022-11-10 10:42 UTC (permalink / raw)
  To: David Howells
  Cc: netdev, kernel test robot, Marc Dionne, linux-afs, linux-kernel,
	yoshfuji, Hideaki Yoshifuji (yoshfuji)

Hi,

2022年11月10日(木) 18:44 David Howells <dhowells@redhat.com>:
>
> Fix rxrpc_encap_err_rcv() to make the call to ipv6_icmp_error conditional
> on IPV6 support being enabled.
>
> Fixes: b6c66c4324e7 ("rxrpc: Use the core ICMP/ICMP6 parsers")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Marc Dionne <marc.dionne@auristor.com>
> cc: linux-afs@lists.infradead.org
> cc: netdev@vger.kernel.org
> ---
>
>  net/rxrpc/local_object.c |    2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/net/rxrpc/local_object.c b/net/rxrpc/local_object.c
> index a178f71e5082..25cdfcf7b415 100644
> --- a/net/rxrpc/local_object.c
> +++ b/net/rxrpc/local_object.c
> @@ -33,7 +33,9 @@ static void rxrpc_encap_err_rcv(struct sock *sk, struct sk_buff *skb, int err,
>  {
>         if (ip_hdr(skb)->version == IPVERSION)
>                 return ip_icmp_error(sk, skb, err, port, info, payload);
> +#ifdef CONFIG_AF_RXRPC_IPV6
>         return ipv6_icmp_error(sk, skb, err, port, info, payload);
> +#endif
>  }
>

Because this introduces a missing return literally without CONFIG_AF_RXRPC_IPV6,
I would prefer #ifdef / #else for the whole function.

--yoshfuji

>  /*
>
>

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

* Re: [PATCH net-next] rxrpc: Fix missing IPV6 #ifdef
  2022-11-10 10:42 ` Hideaki Yoshifuji
@ 2022-11-10 13:26   ` David Howells
  0 siblings, 0 replies; 6+ messages in thread
From: David Howells @ 2022-11-10 13:26 UTC (permalink / raw)
  To: Hideaki Yoshifuji
  Cc: dhowells, netdev, kernel test robot, Marc Dionne, linux-afs,
	linux-kernel, yoshfuji

Hideaki Yoshifuji <hideaki.yoshifuji@miraclelinux.com> wrote:

> Because this introduces a missing return literally without
> CONFIG_AF_RXRPC_IPV6, I would prefer #ifdef / #else for the whole function.

They're both void functions, so actually, there's nothing to return.

David


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

* Re: [PATCH net-next] rxrpc: Fix missing IPV6 #ifdef
  2022-11-10  9:43 [PATCH net-next] rxrpc: Fix missing IPV6 #ifdef David Howells
  2022-11-10 10:42 ` Hideaki Yoshifuji
@ 2022-11-10 13:47 ` Andrew Lunn
  2022-11-10 14:09   ` David Howells
  1 sibling, 1 reply; 6+ messages in thread
From: Andrew Lunn @ 2022-11-10 13:47 UTC (permalink / raw)
  To: David Howells
  Cc: netdev, kernel test robot, Marc Dionne, linux-afs, linux-kernel

On Thu, Nov 10, 2022 at 09:43:34AM +0000, David Howells wrote:
> Fix rxrpc_encap_err_rcv() to make the call to ipv6_icmp_error conditional
> on IPV6 support being enabled.
> 
> Fixes: b6c66c4324e7 ("rxrpc: Use the core ICMP/ICMP6 parsers")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Marc Dionne <marc.dionne@auristor.com>
> cc: linux-afs@lists.infradead.org
> cc: netdev@vger.kernel.org
> ---
> 
>  net/rxrpc/local_object.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/net/rxrpc/local_object.c b/net/rxrpc/local_object.c
> index a178f71e5082..25cdfcf7b415 100644
> --- a/net/rxrpc/local_object.c
> +++ b/net/rxrpc/local_object.c
> @@ -33,7 +33,9 @@ static void rxrpc_encap_err_rcv(struct sock *sk, struct sk_buff *skb, int err,
>  {
>  	if (ip_hdr(skb)->version == IPVERSION)
>  		return ip_icmp_error(sk, skb, err, port, info, payload);
> +#ifdef CONFIG_AF_RXRPC_IPV6
>  	return ipv6_icmp_error(sk, skb, err, port, info, payload);
> +#endif

Can this be if (IS_ENABLED(CONFIG_AF_RXRPC_IPV6) {} rather than
#ifdef? It gives better build testing.

	Andrew

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

* Re: [PATCH net-next] rxrpc: Fix missing IPV6 #ifdef
  2022-11-10 13:47 ` Andrew Lunn
@ 2022-11-10 14:09   ` David Howells
  2022-11-10 15:37     ` Andrew Lunn
  0 siblings, 1 reply; 6+ messages in thread
From: David Howells @ 2022-11-10 14:09 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: dhowells, netdev, kernel test robot, Marc Dionne, linux-afs,
	linux-kernel

Andrew Lunn <andrew@lunn.ch> wrote:

> > +#ifdef CONFIG_AF_RXRPC_IPV6
> >  	return ipv6_icmp_error(sk, skb, err, port, info, payload);
> > +#endif
> 
> Can this be if (IS_ENABLED(CONFIG_AF_RXRPC_IPV6) {} rather than
> #ifdef? It gives better build testing.

Sure.  Does it actually make that much of a difference?  I guess the
declaration is there even if IPV6 is disabled.

David


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

* Re: [PATCH net-next] rxrpc: Fix missing IPV6 #ifdef
  2022-11-10 14:09   ` David Howells
@ 2022-11-10 15:37     ` Andrew Lunn
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2022-11-10 15:37 UTC (permalink / raw)
  To: David Howells
  Cc: netdev, kernel test robot, Marc Dionne, linux-afs, linux-kernel

On Thu, Nov 10, 2022 at 02:09:45PM +0000, David Howells wrote:
> Andrew Lunn <andrew@lunn.ch> wrote:
> 
> > > +#ifdef CONFIG_AF_RXRPC_IPV6
> > >  	return ipv6_icmp_error(sk, skb, err, port, info, payload);
> > > +#endif
> > 
> > Can this be if (IS_ENABLED(CONFIG_AF_RXRPC_IPV6) {} rather than
> > #ifdef? It gives better build testing.
> 
> Sure.  Does it actually make that much of a difference?  I guess the
> declaration is there even if IPV6 is disabled.

And that is the point. Even if this feature is disabled, the type
checking will be performed, the number of parameters etc. Somebody who
modifies ipv6_icmp_error() is going to find problems with a single
compilation, rather than having to use a big collection of random
configs.

So this is a review comment i often make. Avoid #ifdef if you can, use
IS_ENABLED() inside an if statement.

	Andrew

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

end of thread, other threads:[~2022-11-10 15:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-10  9:43 [PATCH net-next] rxrpc: Fix missing IPV6 #ifdef David Howells
2022-11-10 10:42 ` Hideaki Yoshifuji
2022-11-10 13:26   ` David Howells
2022-11-10 13:47 ` Andrew Lunn
2022-11-10 14:09   ` David Howells
2022-11-10 15:37     ` Andrew Lunn

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).