From: Michael Holzheu <holzheu@linux.vnet.ibm.com>
To: linux-s390@vger.kernel.org
Subject: Re: [PATCH] s390/bpf: remove redundant check for non-null image
Date: Tue, 24 Jan 2017 09:50:19 +0000 [thread overview]
Message-ID: <20170124105019.1a5e2766@TP-holzheu> (raw)
In-Reply-To: <20170114105739.GB6789@osiris>
Am Sat, 14 Jan 2017 01:48:24 +0100
schrieb Daniel Borkmann <daniel@iogearbox.net>:
> After we already allocated the jit.prg_buf image via
> bpf_jit_binary_alloc() and filled it out with instructions,
> jit.prg_buf cannot be NULL anymore. Thus, remove the
> unnecessary check. Tested on s390x with test_bpf module.
>
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
> Cc: Michael Holzheu <holzheu@linux.vnet.ibm.com>
> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
> ---
> arch/s390/net/bpf_jit_comp.c | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
> index 167b31b..b4272cd 100644
> --- a/arch/s390/net/bpf_jit_comp.c
> +++ b/arch/s390/net/bpf_jit_comp.c
> @@ -1331,14 +1331,12 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
> }
> if (bpf_jit_enable > 1) {
> bpf_jit_dump(fp->len, jit.size, pass, jit.prg_buf);
> - if (jit.prg_buf)
> - print_fn_code(jit.prg_buf, jit.size_prg);
> - }
> - if (jit.prg_buf) {
> - set_memory_ro((unsigned long)header, header->pages);
> - fp->bpf_func = (void *) jit.prg_buf;
> - fp->jited = 1;
> + print_fn_code(jit.prg_buf, jit.size_prg);
> }
> +
> + set_memory_ro((unsigned long)header, header->pages);
> + fp->bpf_func = (void *) jit.prg_buf;
> + fp->jited = 1;
> free_addrs:
> kfree(jit.addrs);
> out:
Makes sense, thanks!
Michael
parent reply other threads:[~2017-01-24 9:50 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20170114105739.GB6789@osiris>]
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=20170124105019.1a5e2766@TP-holzheu \
--to=holzheu@linux.vnet.ibm.com \
--cc=linux-s390@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