From: Daniel Borkmann <daniel@iogearbox.net>
To: Arnd Bergmann <arnd@arndb.de>,
Alexei Starovoitov <ast@kernel.org>,
"David S. Miller" <davem@davemloft.net>
Cc: John Fastabend <john.fastabend@gmail.com>,
Lawrence Brakmo <brakmo@fb.com>,
Jesper Dangaard Brouer <brouer@redhat.com>,
Jakub Kicinski <jakub.kicinski@netronome.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] bpf: hide a possibly unused variable
Date: Tue, 20 Feb 2018 22:44:29 +0100 [thread overview]
Message-ID: <824bfc29-d6e8-9d7d-9307-79bf0097ce8e@iogearbox.net> (raw)
In-Reply-To: <20180220211658.2653840-1-arnd@arndb.de>
Hi Arnd,
On 02/20/2018 10:16 PM, Arnd Bergmann wrote:
> The only user of this variable is inside of an #ifdef, causing
> a warning without CONFIG_INET:
>
> net/core/filter.c: In function '____bpf_sock_ops_cb_flags_set':
> net/core/filter.c:3382:6: error: unused variable 'val' [-Werror=unused-variable]
> int val = argval & BPF_SOCK_OPS_ALL_CB_FLAGS;
>
> This adds the same #ifdef around the declaration.
>
> Fixes: b13d88072172 ("bpf: Adds field bpf_sock_ops_cb_flags to tcp_sock")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> net/core/filter.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/net/core/filter.c b/net/core/filter.c
> index 08ab4c65a998..c3dc6d60b4bb 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -3379,7 +3379,9 @@ BPF_CALL_2(bpf_sock_ops_cb_flags_set, struct bpf_sock_ops_kern *, bpf_sock,
> int, argval)
> {
> struct sock *sk = bpf_sock->sk;
> +#ifdef CONFIG_INET
> int val = argval & BPF_SOCK_OPS_ALL_CB_FLAGS;
> +#endif
Looks good, thanks for the fix!
Could you move the existing '#ifdef CONFIG_INET' to the beginning of
the function given the only error in case of !CONFIG_INET is -EINVAL
anyway? That would at least not increase the ifdef ugliness further.
Thanks a lot,
Daniel
> if (!sk_fullsock(sk))
> return -EINVAL;
>
next prev parent reply other threads:[~2018-02-20 21:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-20 21:16 Arnd Bergmann
2018-02-20 21:44 ` Daniel Borkmann [this message]
2018-02-20 22:08 ` Arnd Bergmann
2018-02-20 22:12 ` Daniel Borkmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=824bfc29-d6e8-9d7d-9307-79bf0097ce8e@iogearbox.net \
--to=daniel@iogearbox.net \
--cc=arnd@arndb.de \
--cc=ast@kernel.org \
--cc=brakmo@fb.com \
--cc=brouer@redhat.com \
--cc=davem@davemloft.net \
--cc=jakub.kicinski@netronome.com \
--cc=john.fastabend@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®