powerpc/bpf: Use memset32() to pre-fill traps in BPF page(s)
authorNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Mon, 27 Mar 2017 19:37:41 +0000 (01:07 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 17 Aug 2017 13:04:47 +0000 (23:04 +1000)
Use the newly introduced memset32() to pre-fill BPF page(s) with trap
instructions.

Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/net/bpf_jit_comp64.c

index 861c5af1c9c4bdd85dba552b2e41a9587162e3a7..6ba5d253e8575476aadae56db0833a499898167d 100644 (file)
@@ -25,11 +25,7 @@ int bpf_jit_enable __read_mostly;
 
 static void bpf_jit_fill_ill_insns(void *area, unsigned int size)
 {
-       int *p = area;
-
-       /* Fill whole space with trap instructions */
-       while (p < (int *)((char *)area + size))
-               *p++ = BREAKPOINT_INSTRUCTION;
+       memset32(area, BREAKPOINT_INSTRUCTION, size/4);
 }
 
 static inline void bpf_flush_icache(void *start, void *end)