From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Tobias Tefke <tobias.tefke@gmail.com>
Cc: tobias.tefke@tutanota.com, ast@kernel.org, daniel@iogearbox.net,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] bpf: remove unnecessary condition in bpf_check()
Date: Mon, 9 Jul 2018 16:01:01 -0700 [thread overview]
Message-ID: <20180709230059.p6afqogzp6rb4ka4@ast-mbp.dhcp.thefacebook.com> (raw)
In-Reply-To: <20180709114837.23864-1-tobias.tefke@tutanota.com>
On Mon, Jul 09, 2018 at 01:48:37PM +0200, Tobias Tefke wrote:
> In the label skip_full_check the function sanitize_dead_code()
> is being called if the return value equals zero.
> After that call there is another condition checking
> if the return value equals zero.
> If this condition evaluates to true,
> check_max_stack_depth() is being called.
> However, sanitize_dead_code() has no return value.
> Therefore the return value of bpf_check() is still the same
> and the condition can be removed.
>
> Signed-off-by: Tobias Tefke <tobias.tefke@tutanota.com>
> ---
> kernel/bpf/verifier.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index 9e2bf834f13a..b022d0a85427 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
> @@ -5935,11 +5935,10 @@ int bpf_check(struct bpf_prog **prog, union bpf_attr *attr)
> while (!pop_stack(env, NULL, NULL));
> free_states(env);
>
> - if (ret == 0)
> + if (ret == 0) {
> sanitize_dead_code(env);
> -
> - if (ret == 0)
> ret = check_max_stack_depth(env);
> + }
Technically the patch is correct, but I think it would make
the code harder to read. I prefer to keep it as-is.
prev parent reply other threads:[~2018-07-09 23:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-09 11:48 [PATCH] bpf: remove unnecessary condition in bpf_check() Tobias Tefke
2018-07-09 23:01 ` Alexei Starovoitov [this message]
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=20180709230059.p6afqogzp6rb4ka4@ast-mbp.dhcp.thefacebook.com \
--to=alexei.starovoitov@gmail.com \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tobias.tefke@gmail.com \
--cc=tobias.tefke@tutanota.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;
as well as URLs for NNTP newsgroup(s).