Commit 052de33c authored by Daniel Borkmann's avatar Daniel Borkmann Committed by Michael Ellerman

powerpc/bpf: Remove redundant check for non-null image

We have a check earlier to ensure we don't proceed if image is NULL. As
such, the redundant check can be removed.
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
[Added similar changes for classic BPF JIT]
Signed-off-by: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 14a3ae34
...@@ -662,16 +662,17 @@ void bpf_jit_compile(struct bpf_prog *fp) ...@@ -662,16 +662,17 @@ void bpf_jit_compile(struct bpf_prog *fp)
*/ */
bpf_jit_dump(flen, proglen, pass, code_base); bpf_jit_dump(flen, proglen, pass, code_base);
if (image) { bpf_flush_icache(code_base, code_base + (proglen/4));
bpf_flush_icache(code_base, code_base + (proglen/4));
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
/* Function descriptor nastiness: Address + TOC */ /* Function descriptor nastiness: Address + TOC */
((u64 *)image)[0] = (u64)code_base; ((u64 *)image)[0] = (u64)code_base;
((u64 *)image)[1] = local_paca->kernel_toc; ((u64 *)image)[1] = local_paca->kernel_toc;
#endif #endif
fp->bpf_func = (void *)image;
fp->jited = 1; fp->bpf_func = (void *)image;
} fp->jited = 1;
out: out:
kfree(addrs); kfree(addrs);
return; return;
......
...@@ -1046,16 +1046,16 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp) ...@@ -1046,16 +1046,16 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
*/ */
bpf_jit_dump(flen, proglen, pass, code_base); bpf_jit_dump(flen, proglen, pass, code_base);
if (image) { bpf_flush_icache(bpf_hdr, image + alloclen);
bpf_flush_icache(bpf_hdr, image + alloclen);
#ifdef PPC64_ELF_ABI_v1 #ifdef PPC64_ELF_ABI_v1
/* Function descriptor nastiness: Address + TOC */ /* Function descriptor nastiness: Address + TOC */
((u64 *)image)[0] = (u64)code_base; ((u64 *)image)[0] = (u64)code_base;
((u64 *)image)[1] = local_paca->kernel_toc; ((u64 *)image)[1] = local_paca->kernel_toc;
#endif #endif
fp->bpf_func = (void *)image;
fp->jited = 1; fp->bpf_func = (void *)image;
} fp->jited = 1;
out: out:
kfree(addrs); kfree(addrs);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment