Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 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>

authored by

Daniel Borkmann and committed by
Michael Ellerman
052de33c 14a3ae34

+17 -16
+9 -8
arch/powerpc/net/bpf_jit_comp.c
··· 662 662 */ 663 663 bpf_jit_dump(flen, proglen, pass, code_base); 664 664 665 - if (image) { 666 - bpf_flush_icache(code_base, code_base + (proglen/4)); 665 + bpf_flush_icache(code_base, code_base + (proglen/4)); 666 + 667 667 #ifdef CONFIG_PPC64 668 - /* Function descriptor nastiness: Address + TOC */ 669 - ((u64 *)image)[0] = (u64)code_base; 670 - ((u64 *)image)[1] = local_paca->kernel_toc; 668 + /* Function descriptor nastiness: Address + TOC */ 669 + ((u64 *)image)[0] = (u64)code_base; 670 + ((u64 *)image)[1] = local_paca->kernel_toc; 671 671 #endif 672 - fp->bpf_func = (void *)image; 673 - fp->jited = 1; 674 - } 672 + 673 + fp->bpf_func = (void *)image; 674 + fp->jited = 1; 675 + 675 676 out: 676 677 kfree(addrs); 677 678 return;
+8 -8
arch/powerpc/net/bpf_jit_comp64.c
··· 1046 1046 */ 1047 1047 bpf_jit_dump(flen, proglen, pass, code_base); 1048 1048 1049 - if (image) { 1050 - bpf_flush_icache(bpf_hdr, image + alloclen); 1049 + bpf_flush_icache(bpf_hdr, image + alloclen); 1050 + 1051 1051 #ifdef PPC64_ELF_ABI_v1 1052 - /* Function descriptor nastiness: Address + TOC */ 1053 - ((u64 *)image)[0] = (u64)code_base; 1054 - ((u64 *)image)[1] = local_paca->kernel_toc; 1052 + /* Function descriptor nastiness: Address + TOC */ 1053 + ((u64 *)image)[0] = (u64)code_base; 1054 + ((u64 *)image)[1] = local_paca->kernel_toc; 1055 1055 #endif 1056 - fp->bpf_func = (void *)image; 1057 - fp->jited = 1; 1058 - } 1056 + 1057 + fp->bpf_func = (void *)image; 1058 + fp->jited = 1; 1059 1059 1060 1060 out: 1061 1061 kfree(addrs);