diff mbox series

[net-next] net/ip6mr: Fix build with !CONFIG_IPV6_PIMSM_V2

Message ID 20220223121721.421247-1-dima@arista.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net/ip6mr: Fix build with !CONFIG_IPV6_PIMSM_V2 | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 2 this patch: 2
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes fail Problems with Fixes tag: 1
netdev/build_allmodconfig_warn success Errors and warnings before: 2 this patch: 2
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 14 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Dmitry Safonov Feb. 23, 2022, 12:17 p.m. UTC
The following build-error on my config:
net/ipv6/ip6mr.c: In function ‘ip6_mroute_setsockopt’:
net/ipv6/ip6mr.c:1656:14: error: unused variable ‘do_wrmifwhole’ [-Werror=unused-variable]
 1656 |         bool do_wrmifwhole;
      |              ^

Cc: Mobashshera Rasool <mobash.rasool.linux@gmail.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Cc: David Ahern <dsahern@kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org
Fixes: 4b340a5a726d
Signed-off-by: Dmitry Safonov <dima@arista.com>
---
 net/ipv6/ip6mr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


base-commit: 922ea87ff6f2b63f413c6afa2c25b287dce76639

Comments

David Ahern Feb. 25, 2022, 3 a.m. UTC | #1
On 2/23/22 5:17 AM, Dmitry Safonov wrote:
> diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
> index a9775c830194..4e74bc61a3db 100644
> --- a/net/ipv6/ip6mr.c
> +++ b/net/ipv6/ip6mr.c
> @@ -1653,7 +1653,6 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, sockptr_t optval,
>  	mifi_t mifi;
>  	struct net *net = sock_net(sk);
>  	struct mr_table *mrt;
> -	bool do_wrmifwhole;
>  
>  	if (sk->sk_type != SOCK_RAW ||
>  	    inet_sk(sk)->inet_num != IPPROTO_ICMPV6)
> @@ -1761,6 +1760,7 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, sockptr_t optval,
>  #ifdef CONFIG_IPV6_PIMSM_V2
>  	case MRT6_PIM:
>  	{
> +		bool do_wrmifwhole;
>  		int v;
>  
>  		if (optlen != sizeof(v))
> 
> base-commit: 922ea87ff6f2b63f413c6afa2c25b287dce76639

you could do one better and move it under the
'if (v != mrt->mroute_do_pim) {'

so that the do_wrmifwhole check is only done when needed
Dmitry Safonov Feb. 25, 2022, 2:54 p.m. UTC | #2
On 2/25/22 03:00, David Ahern wrote:
> On 2/23/22 5:17 AM, Dmitry Safonov wrote:
>> diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
>> index a9775c830194..4e74bc61a3db 100644
>> --- a/net/ipv6/ip6mr.c
>> +++ b/net/ipv6/ip6mr.c
>> @@ -1653,7 +1653,6 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, sockptr_t optval,
>>  	mifi_t mifi;
>>  	struct net *net = sock_net(sk);
>>  	struct mr_table *mrt;
>> -	bool do_wrmifwhole;
>>  
>>  	if (sk->sk_type != SOCK_RAW ||
>>  	    inet_sk(sk)->inet_num != IPPROTO_ICMPV6)
>> @@ -1761,6 +1760,7 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, sockptr_t optval,
>>  #ifdef CONFIG_IPV6_PIMSM_V2
>>  	case MRT6_PIM:
>>  	{
>> +		bool do_wrmifwhole;
>>  		int v;
>>  
>>  		if (optlen != sizeof(v))
>>
>> base-commit: 922ea87ff6f2b63f413c6afa2c25b287dce76639
> 
> you could do one better and move it under the
> 'if (v != mrt->mroute_do_pim) {'
> 
> so that the do_wrmifwhole check is only done when needed

I've tried to keep it simple and just to fix the build as I don't know
which tests to run.
Anyway, I sent v2:
https://lore.kernel.org/all/20220225145206.561409-1-dima@arista.com/T/#u

Is it what you meant?

Thanks,
          Dmitry
diff mbox series

Patch

diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index a9775c830194..4e74bc61a3db 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -1653,7 +1653,6 @@  int ip6_mroute_setsockopt(struct sock *sk, int optname, sockptr_t optval,
 	mifi_t mifi;
 	struct net *net = sock_net(sk);
 	struct mr_table *mrt;
-	bool do_wrmifwhole;
 
 	if (sk->sk_type != SOCK_RAW ||
 	    inet_sk(sk)->inet_num != IPPROTO_ICMPV6)
@@ -1761,6 +1760,7 @@  int ip6_mroute_setsockopt(struct sock *sk, int optname, sockptr_t optval,
 #ifdef CONFIG_IPV6_PIMSM_V2
 	case MRT6_PIM:
 	{
+		bool do_wrmifwhole;
 		int v;
 
 		if (optlen != sizeof(v))