]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
powerpc/bpf: Remove redundant check for non-null image
authorDaniel Borkmann <daniel@iogearbox.net>
Fri, 13 Jan 2017 17:10:00 +0000 (22:40 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 25 Jan 2017 02:34:24 +0000 (13:34 +1100)
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: Daniel Borkmann <daniel@iogearbox.net>
[Added similar changes for classic BPF JIT]
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/net/bpf_jit_comp.c
arch/powerpc/net/bpf_jit_comp64.c

index 7e706f36e364ac1ed7a66a095f8a4261ca62f8c7..f9941b3b5770fca641d2f4a8cf70dbb727fe8b70 100644 (file)
@@ -662,16 +662,17 @@ void bpf_jit_compile(struct bpf_prog *fp)
                 */
                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
-               /* Function descriptor nastiness: Address + TOC */
-               ((u64 *)image)[0] = (u64)code_base;
-               ((u64 *)image)[1] = local_paca->kernel_toc;
+       /* Function descriptor nastiness: Address + TOC */
+       ((u64 *)image)[0] = (u64)code_base;
+       ((u64 *)image)[1] = local_paca->kernel_toc;
 #endif
-               fp->bpf_func = (void *)image;
-               fp->jited = 1;
-       }
+
+       fp->bpf_func = (void *)image;
+       fp->jited = 1;
+
 out:
        kfree(addrs);
        return;
index 73a5cf18fd84f3553f564456f0e482977afdfbe2..935a10f77cfe8afab7f42338934fc5e209fd00b7 100644 (file)
@@ -1046,16 +1046,16 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
                 */
                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
-               /* Function descriptor nastiness: Address + TOC */
-               ((u64 *)image)[0] = (u64)code_base;
-               ((u64 *)image)[1] = local_paca->kernel_toc;
+       /* Function descriptor nastiness: Address + TOC */
+       ((u64 *)image)[0] = (u64)code_base;
+       ((u64 *)image)[1] = local_paca->kernel_toc;
 #endif
-               fp->bpf_func = (void *)image;
-               fp->jited = 1;
-       }
+
+       fp->bpf_func = (void *)image;
+       fp->jited = 1;
 
 out:
        kfree(addrs);