All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bpf/test_run: Add braces to initialization in bpf_prog_test_run_skb
@ 2018-10-19 18:26 Nathan Chancellor
  2018-10-19 18:46 ` Eric Dumazet
  0 siblings, 1 reply; 4+ messages in thread
From: Nathan Chancellor @ 2018-10-19 18:26 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann
  Cc: netdev, linux-kernel, Nathan Chancellor

Clang warns:

net/bpf/test_run.c:120:20: error: suggest braces around initialization
of subobject [-Werror,-Wmissing-braces]
        struct sock sk = {0};
                          ^
                          {}

Add the braces to properly initialize all subobjects.

Fixes: 75079847e9d0 ("bpf: add tests for direct packet access from CGROUP_SKB")
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
 net/bpf/test_run.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
index 8dccac305268..65e049c61a7a 100644
--- a/net/bpf/test_run.c
+++ b/net/bpf/test_run.c
@@ -117,7 +117,7 @@ int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr,
 	u32 retval, duration;
 	int hh_len = ETH_HLEN;
 	struct sk_buff *skb;
-	struct sock sk = {0};
+	struct sock sk = { { {0} } };
 	void *data;
 	int ret;
 
-- 
2.19.1


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

* Re: [PATCH] bpf/test_run: Add braces to initialization in bpf_prog_test_run_skb
  2018-10-19 18:26 [PATCH] bpf/test_run: Add braces to initialization in bpf_prog_test_run_skb Nathan Chancellor
@ 2018-10-19 18:46 ` Eric Dumazet
  2018-10-19 18:47   ` Alexei Starovoitov
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2018-10-19 18:46 UTC (permalink / raw)
  To: Nathan Chancellor, Alexei Starovoitov, Daniel Borkmann
  Cc: netdev, linux-kernel



On 10/19/2018 11:26 AM, Nathan Chancellor wrote:
> Clang warns:
> 
> net/bpf/test_run.c:120:20: error: suggest braces around initialization
> of subobject [-Werror,-Wmissing-braces]
>         struct sock sk = {0};
>                           ^
>                           {}
> 
> Add the braces to properly initialize all subobjects.
> 
> Fixes: 75079847e9d0 ("bpf: add tests for direct packet access from CGROUP_SKB")
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
>  net/bpf/test_run.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
> index 8dccac305268..65e049c61a7a 100644
> --- a/net/bpf/test_run.c
> +++ b/net/bpf/test_run.c
> @@ -117,7 +117,7 @@ int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr,
>  	u32 retval, duration;
>  	int hh_len = ETH_HLEN;
>  	struct sk_buff *skb;
> -	struct sock sk = {0};
> +	struct sock sk = { { {0} } };
>  	void *data;
>  	int ret;
>  
> 

Strange, I thought this patch was still under discussion.
Has an old version of it being merged somewhere ?

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

* Re: [PATCH] bpf/test_run: Add braces to initialization in bpf_prog_test_run_skb
  2018-10-19 18:46 ` Eric Dumazet
@ 2018-10-19 18:47   ` Alexei Starovoitov
  2018-10-19 19:03     ` Nathan Chancellor
  0 siblings, 1 reply; 4+ messages in thread
From: Alexei Starovoitov @ 2018-10-19 18:47 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: natechancellor, Alexei Starovoitov, Daniel Borkmann,
	Network Development, LKML

On Fri, Oct 19, 2018 at 11:46 AM Eric Dumazet <eric.dumazet@gmail.com> wrote:
>
>
>
> On 10/19/2018 11:26 AM, Nathan Chancellor wrote:
> > Clang warns:
> >
> > net/bpf/test_run.c:120:20: error: suggest braces around initialization
> > of subobject [-Werror,-Wmissing-braces]
> >         struct sock sk = {0};
> >                           ^
> >                           {}
> >
> > Add the braces to properly initialize all subobjects.
> >
> > Fixes: 75079847e9d0 ("bpf: add tests for direct packet access from CGROUP_SKB")
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > ---
> >  net/bpf/test_run.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
> > index 8dccac305268..65e049c61a7a 100644
> > --- a/net/bpf/test_run.c
> > +++ b/net/bpf/test_run.c
> > @@ -117,7 +117,7 @@ int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr,
> >       u32 retval, duration;
> >       int hh_len = ETH_HLEN;
> >       struct sk_buff *skb;
> > -     struct sock sk = {0};
> > +     struct sock sk = { { {0} } };
> >       void *data;
> >       int ret;
> >
> >
>
> Strange, I thought this patch was still under discussion.
> Has an old version of it being merged somewhere ?

merged and reverted. This patch is not necessary.

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

* Re: [PATCH] bpf/test_run: Add braces to initialization in bpf_prog_test_run_skb
  2018-10-19 18:47   ` Alexei Starovoitov
@ 2018-10-19 19:03     ` Nathan Chancellor
  0 siblings, 0 replies; 4+ messages in thread
From: Nathan Chancellor @ 2018-10-19 19:03 UTC (permalink / raw)
  To: Alexei Starovoitov
  Cc: Eric Dumazet, Alexei Starovoitov, Daniel Borkmann,
	Network Development, LKML

On Fri, Oct 19, 2018 at 11:47:34AM -0700, Alexei Starovoitov wrote:
> On Fri, Oct 19, 2018 at 11:46 AM Eric Dumazet <eric.dumazet@gmail.com> wrote:
> >
> >
> >
> > On 10/19/2018 11:26 AM, Nathan Chancellor wrote:
> > > Clang warns:
> > >
> > > net/bpf/test_run.c:120:20: error: suggest braces around initialization
> > > of subobject [-Werror,-Wmissing-braces]
> > >         struct sock sk = {0};
> > >                           ^
> > >                           {}
> > >
> > > Add the braces to properly initialize all subobjects.
> > >
> > > Fixes: 75079847e9d0 ("bpf: add tests for direct packet access from CGROUP_SKB")
> > > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > > ---
> > >  net/bpf/test_run.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
> > > index 8dccac305268..65e049c61a7a 100644
> > > --- a/net/bpf/test_run.c
> > > +++ b/net/bpf/test_run.c
> > > @@ -117,7 +117,7 @@ int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr,
> > >       u32 retval, duration;
> > >       int hh_len = ETH_HLEN;
> > >       struct sk_buff *skb;
> > > -     struct sock sk = {0};
> > > +     struct sock sk = { { {0} } };
> > >       void *data;
> > >       int ret;
> > >
> > >
> >
> > Strange, I thought this patch was still under discussion.
> > Has an old version of it being merged somewhere ?

Looks like it made its way into -next in the 20181019 version, which
is what I am working off of.

> 
> merged and reverted. This patch is not necessary.

Thank you for the heads up and sorry for the noise!
Nathan

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

end of thread, other threads:[~2018-10-19 19:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-19 18:26 [PATCH] bpf/test_run: Add braces to initialization in bpf_prog_test_run_skb Nathan Chancellor
2018-10-19 18:46 ` Eric Dumazet
2018-10-19 18:47   ` Alexei Starovoitov
2018-10-19 19:03     ` Nathan Chancellor

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.