diff mbox series

geneve: Add missing braces in addr6 initializer

Message ID 20181112221248.11477-1-natechancellor@gmail.com
State Changes Requested, archived
Delegated to: David Miller
Headers show
Series geneve: Add missing braces in addr6 initializer | expand

Commit Message

Nathan Chancellor Nov. 12, 2018, 10:12 p.m. UTC
Clang warns:

drivers/net/geneve.c:428:29: error: suggest braces around initialization
of subobject [-Werror,-Wmissing-braces]
                struct in6_addr addr6 = { 0 };
                                          ^
                                          {}

Fixes: a07966447f39 ("geneve: ICMP error lookup handler")
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
 drivers/net/geneve.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stefano Brivio Nov. 12, 2018, 10:19 p.m. UTC | #1
On Mon, 12 Nov 2018 15:12:48 -0700
Nathan Chancellor <natechancellor@gmail.com> wrote:

> Clang warns:
> 
> drivers/net/geneve.c:428:29: error: suggest braces around initialization
> of subobject [-Werror,-Wmissing-braces]
>                 struct in6_addr addr6 = { 0 };
>                                           ^
>                                           {}
> 
> Fixes: a07966447f39 ("geneve: ICMP error lookup handler")
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>

Thanks for spotting this. By the way, I guess you should indicate in
the subject when patches are meant for net-next.

Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
Nathan Chancellor Nov. 12, 2018, 10:20 p.m. UTC | #2
On Mon, Nov 12, 2018 at 11:19:17PM +0100, Stefano Brivio wrote:
> On Mon, 12 Nov 2018 15:12:48 -0700
> Nathan Chancellor <natechancellor@gmail.com> wrote:
> 
> > Clang warns:
> > 
> > drivers/net/geneve.c:428:29: error: suggest braces around initialization
> > of subobject [-Werror,-Wmissing-braces]
> >                 struct in6_addr addr6 = { 0 };
> >                                           ^
> >                                           {}
> > 
> > Fixes: a07966447f39 ("geneve: ICMP error lookup handler")
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> 
> Thanks for spotting this. By the way, I guess you should indicate in
> the subject when patches are meant for net-next.
> 

Sure, I'll be better about that in the future.

> Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
> 

Thank you for the review!
Nathan

> -- 
> Stefano
Joe Perches Nov. 12, 2018, 10:36 p.m. UTC | #3
On Mon, 2018-11-12 at 15:12 -0700, Nathan Chancellor wrote:
> Clang warns:
> 
> drivers/net/geneve.c:428:29: error: suggest braces around initialization
> of subobject [-Werror,-Wmissing-braces]
>                 struct in6_addr addr6 = { 0 };
>                                           ^
>                                           {}

Perhaps just remove the 0.

> diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
[]
> @@ -425,7 +425,7 @@ static int geneve_udp_encap_err_lookup(struct sock *sk, struct sk_buff *skb)
>  #if IS_ENABLED(CONFIG_IPV6)
>  	if (geneve_get_sk_family(gs) == AF_INET6) {
>  		struct ipv6hdr *ip6h = ipv6_hdr(skb);
> -		struct in6_addr addr6 = { 0 };
> +		struct in6_addr addr6 = { { 0 } };
>  
>  		if (!gs->collect_md) {
>  			vni = geneve_hdr(skb)->vni;
David Miller Nov. 15, 2018, 7:35 p.m. UTC | #4
From: Nathan Chancellor <natechancellor@gmail.com>
Date: Mon, 12 Nov 2018 15:12:48 -0700

> Clang warns:
> 
> drivers/net/geneve.c:428:29: error: suggest braces around initialization
> of subobject [-Werror,-Wmissing-braces]
>                 struct in6_addr addr6 = { 0 };
>                                           ^
>                                           {}
> 
> Fixes: a07966447f39 ("geneve: ICMP error lookup handler")
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>

And this makes GCC warn.

drivers/net/geneve.c: In function ‘geneve_udp_encap_err_lookup’:
drivers/net/geneve.c:428:27: warning: missing braces around initializer [-Wmissing-braces]
   struct in6_addr addr6 = { { 0 } };
                           ^
                               { }

(╯°□°)╯︵ ┻━┻
Nathan Chancellor Nov. 15, 2018, 7:38 p.m. UTC | #5
On Thu, Nov 15, 2018 at 11:35:01AM -0800, David Miller wrote:
> From: Nathan Chancellor <natechancellor@gmail.com>
> Date: Mon, 12 Nov 2018 15:12:48 -0700
> 
> > Clang warns:
> > 
> > drivers/net/geneve.c:428:29: error: suggest braces around initialization
> > of subobject [-Werror,-Wmissing-braces]
> >                 struct in6_addr addr6 = { 0 };
> >                                           ^
> >                                           {}
> > 
> > Fixes: a07966447f39 ("geneve: ICMP error lookup handler")
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> 
> And this makes GCC warn.
> 
> drivers/net/geneve.c: In function ‘geneve_udp_encap_err_lookup’:
> drivers/net/geneve.c:428:27: warning: missing braces around initializer [-Wmissing-braces]
>    struct in6_addr addr6 = { { 0 } };
>                            ^
>                                { }
> 
> (╯°□°)╯︵ ┻━┻

Yes, sorry, I thought I test built before sending it but apparently not
:( v2 should be sitting in your inbox as a reply to this one unless I
screwed that up too...

Nathan
diff mbox series

Patch

diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index 7c53e06b31c3..224d8b0bb5de 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -425,7 +425,7 @@  static int geneve_udp_encap_err_lookup(struct sock *sk, struct sk_buff *skb)
 #if IS_ENABLED(CONFIG_IPV6)
 	if (geneve_get_sk_family(gs) == AF_INET6) {
 		struct ipv6hdr *ip6h = ipv6_hdr(skb);
-		struct in6_addr addr6 = { 0 };
+		struct in6_addr addr6 = { { 0 } };
 
 		if (!gs->collect_md) {
 			vni = geneve_hdr(skb)->vni;