From: Song Liu <songliubraving@fb.com>
To: Mao Wenan <maowenan@huawei.com>
Cc: "ast@kernel.org" <ast@kernel.org>,
"daniel@iogearbox.net" <daniel@iogearbox.net>,
Martin Lau <kafai@fb.com>, Yonghong Song <yhs@fb.com>,
Andrii Nakryiko <andriin@fb.com>,
"john.fastabend@gmail.com" <john.fastabend@gmail.com>,
"kpsingh@chromium.org" <kpsingh@chromium.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"kernel-janitors@vger.kernel.org"
<kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH bpf-next v2] bpf: remove set but not used variable 'dst_known'
Date: Sat, 18 Apr 2020 06:13:48 +0000 [thread overview]
Message-ID: <C7067847-8EDB-49B5-8DDF-C8504BB82962@fb.com> (raw)
In-Reply-To: <20200418013735.67882-1-maowenan@huawei.com>
> On Apr 17, 2020, at 6:37 PM, Mao Wenan <maowenan@huawei.com> wrote:
>
> Fixes gcc '-Wunused-but-set-variable' warning:
>
> kernel/bpf/verifier.c:5603:18: warning: variable ‘dst_known’
> set but not used [-Wunused-but-set-variable], delete this
> variable.
>
> Signed-off-by: Mao Wenan <maowenan@huawei.com>
Acked-by: Song Liu <songliubraving@fb.com>
With one nit below.
> ---
> v2: remove fixes tag in commit log.
> kernel/bpf/verifier.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index 04c6630cc18f..c9f50969a689 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
> @@ -5600,7 +5600,7 @@ static int adjust_scalar_min_max_vals(struct bpf_verifier_env *env,
> {
> struct bpf_reg_state *regs = cur_regs(env);
> u8 opcode = BPF_OP(insn->code);
> - bool src_known, dst_known;
> + bool src_known;
This is not a hard rule, but we prefer to keep variable definition in
"reverse Christmas tree" order. Since we are on this function, let's
reorder these definitions to something like:
u64 insn_bitness = (BPF_CLASS(insn->code) == BPF_ALU64) ? 64 : 32;
struct bpf_reg_state *regs = cur_regs(env);
u8 opcode = BPF_OP(insn->code);
u32 dst = insn->dst_reg;
s64 smin_val, smax_val;
u64 umin_val, umax_val;
bool src_known;
int ret;
next prev parent reply other threads:[~2020-04-18 6:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-13 11:37 [PATCH -next] " Mao Wenan
2020-04-14 22:05 ` Song Liu
2020-04-15 1:37 ` maowenan
2020-04-15 7:23 ` Song Liu
2020-04-15 7:52 ` maowenan
2020-04-18 1:37 ` [PATCH bpf-next v2] " Mao Wenan
2020-04-18 6:13 ` Song Liu [this message]
2020-04-21 3:23 ` Alexei Starovoitov
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=C7067847-8EDB-49B5-8DDF-C8504BB82962@fb.com \
--to=songliubraving@fb.com \
--cc=andriin@fb.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kpsingh@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maowenan@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=yhs@fb.com \
/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®