bpf: Fix leftover header->pages in sparc and powerpc code.
authorSong Liu <song@kernel.org>
Tue, 8 Feb 2022 22:05:08 +0000 (14:05 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 8 Feb 2022 22:52:05 +0000 (14:52 -0800)
Replace header->pages * PAGE_SIZE with new header->size.

Fixes: ed2d9e1a26cc ("bpf: Use size instead of pages in bpf_binary_header")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20220208220509.4180389-2-song@kernel.org
arch/powerpc/net/bpf_jit_comp.c
arch/sparc/net/bpf_jit_comp_64.c

index d6ffdd0f2309d0bbfb06fdc7c94d8490502db093..9003c313475dc07c7ad1a3c54af394f2a27573b1 100644 (file)
@@ -247,7 +247,7 @@ skip_codegen_passes:
        fp->jited = 1;
        fp->jited_len = proglen + FUNCTION_DESCR_SIZE;
 
-       bpf_flush_icache(bpf_hdr, (u8 *)bpf_hdr + (bpf_hdr->pages * PAGE_SIZE));
+       bpf_flush_icache(bpf_hdr, (u8 *)bpf_hdr + bpf_hdr->size);
        if (!fp->is_func || extra_pass) {
                bpf_jit_binary_lock_ro(bpf_hdr);
                bpf_prog_fill_jited_linfo(fp, addrs);
index b1e38784eb2386fddcc510717e06dc8541290ef8..fa0759bfe498e917b0b215d2a24d1269d645161f 100644 (file)
@@ -1599,7 +1599,7 @@ skip_init_ctx:
        if (bpf_jit_enable > 1)
                bpf_jit_dump(prog->len, image_size, pass, ctx.image);
 
-       bpf_flush_icache(header, (u8 *)header + (header->pages * PAGE_SIZE));
+       bpf_flush_icache(header, (u8 *)header + header->size);
 
        if (!prog->is_func || extra_pass) {
                bpf_jit_binary_lock_ro(header);