Commit 9919c5c9 authored by Rafael Passos's avatar Rafael Passos Committed by Alexei Starovoitov

bpf: remove unused parameter in bpf_jit_binary_pack_finalize

Fixes a compiler warning. the bpf_jit_binary_pack_finalize function
was taking an extra bpf_prog parameter that went unused.
This removves it and updates the callers accordingly.
Signed-off-by: default avatarRafael Passos <rafael@rcpassos.me>
Link: https://lore.kernel.org/r/20240615022641.210320-2-rafael@rcpassos.meSigned-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent 3b063043
...@@ -1829,8 +1829,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) ...@@ -1829,8 +1829,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
prog->jited_len = 0; prog->jited_len = 0;
goto out_free_hdr; goto out_free_hdr;
} }
if (WARN_ON(bpf_jit_binary_pack_finalize(prog, ro_header, if (WARN_ON(bpf_jit_binary_pack_finalize(ro_header, header))) {
header))) {
/* ro_header has been freed */ /* ro_header has been freed */
ro_header = NULL; ro_header = NULL;
prog = orig_prog; prog = orig_prog;
......
...@@ -225,7 +225,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp) ...@@ -225,7 +225,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
fp->jited_len = proglen + FUNCTION_DESCR_SIZE; fp->jited_len = proglen + FUNCTION_DESCR_SIZE;
if (!fp->is_func || extra_pass) { if (!fp->is_func || extra_pass) {
if (bpf_jit_binary_pack_finalize(fp, fhdr, hdr)) { if (bpf_jit_binary_pack_finalize(fhdr, hdr)) {
fp = org_fp; fp = org_fp;
goto out_addrs; goto out_addrs;
} }
...@@ -348,7 +348,7 @@ void bpf_jit_free(struct bpf_prog *fp) ...@@ -348,7 +348,7 @@ void bpf_jit_free(struct bpf_prog *fp)
* before freeing it. * before freeing it.
*/ */
if (jit_data) { if (jit_data) {
bpf_jit_binary_pack_finalize(fp, jit_data->fhdr, jit_data->hdr); bpf_jit_binary_pack_finalize(jit_data->fhdr, jit_data->hdr);
kvfree(jit_data->addrs); kvfree(jit_data->addrs);
kfree(jit_data); kfree(jit_data);
} }
......
...@@ -178,8 +178,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) ...@@ -178,8 +178,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
prog->jited_len = prog_size - cfi_get_offset(); prog->jited_len = prog_size - cfi_get_offset();
if (!prog->is_func || extra_pass) { if (!prog->is_func || extra_pass) {
if (WARN_ON(bpf_jit_binary_pack_finalize(prog, jit_data->ro_header, if (WARN_ON(bpf_jit_binary_pack_finalize(jit_data->ro_header, jit_data->header))) {
jit_data->header))) {
/* ro_header has been freed */ /* ro_header has been freed */
jit_data->ro_header = NULL; jit_data->ro_header = NULL;
prog = orig_prog; prog = orig_prog;
...@@ -258,7 +257,7 @@ void bpf_jit_free(struct bpf_prog *prog) ...@@ -258,7 +257,7 @@ void bpf_jit_free(struct bpf_prog *prog)
* before freeing it. * before freeing it.
*/ */
if (jit_data) { if (jit_data) {
bpf_jit_binary_pack_finalize(prog, jit_data->ro_header, jit_data->header); bpf_jit_binary_pack_finalize(jit_data->ro_header, jit_data->header);
kfree(jit_data); kfree(jit_data);
} }
hdr = bpf_jit_binary_pack_hdr(prog); hdr = bpf_jit_binary_pack_hdr(prog);
......
...@@ -3356,7 +3356,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) ...@@ -3356,7 +3356,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
* *
* Both cases are serious bugs and justify WARN_ON. * Both cases are serious bugs and justify WARN_ON.
*/ */
if (WARN_ON(bpf_jit_binary_pack_finalize(prog, header, rw_header))) { if (WARN_ON(bpf_jit_binary_pack_finalize(header, rw_header))) {
/* header has been freed */ /* header has been freed */
header = NULL; header = NULL;
goto out_image; goto out_image;
...@@ -3435,7 +3435,7 @@ void bpf_jit_free(struct bpf_prog *prog) ...@@ -3435,7 +3435,7 @@ void bpf_jit_free(struct bpf_prog *prog)
* before freeing it. * before freeing it.
*/ */
if (jit_data) { if (jit_data) {
bpf_jit_binary_pack_finalize(prog, jit_data->header, bpf_jit_binary_pack_finalize(jit_data->header,
jit_data->rw_header); jit_data->rw_header);
kvfree(jit_data->addrs); kvfree(jit_data->addrs);
kfree(jit_data); kfree(jit_data);
......
...@@ -1129,8 +1129,7 @@ bpf_jit_binary_pack_alloc(unsigned int proglen, u8 **ro_image, ...@@ -1129,8 +1129,7 @@ bpf_jit_binary_pack_alloc(unsigned int proglen, u8 **ro_image,
struct bpf_binary_header **rw_hdr, struct bpf_binary_header **rw_hdr,
u8 **rw_image, u8 **rw_image,
bpf_jit_fill_hole_t bpf_fill_ill_insns); bpf_jit_fill_hole_t bpf_fill_ill_insns);
int bpf_jit_binary_pack_finalize(struct bpf_prog *prog, int bpf_jit_binary_pack_finalize(struct bpf_binary_header *ro_header,
struct bpf_binary_header *ro_header,
struct bpf_binary_header *rw_header); struct bpf_binary_header *rw_header);
void bpf_jit_binary_pack_free(struct bpf_binary_header *ro_header, void bpf_jit_binary_pack_free(struct bpf_binary_header *ro_header,
struct bpf_binary_header *rw_header); struct bpf_binary_header *rw_header);
......
...@@ -1174,8 +1174,7 @@ bpf_jit_binary_pack_alloc(unsigned int proglen, u8 **image_ptr, ...@@ -1174,8 +1174,7 @@ bpf_jit_binary_pack_alloc(unsigned int proglen, u8 **image_ptr,
} }
/* Copy JITed text from rw_header to its final location, the ro_header. */ /* Copy JITed text from rw_header to its final location, the ro_header. */
int bpf_jit_binary_pack_finalize(struct bpf_prog *prog, int bpf_jit_binary_pack_finalize(struct bpf_binary_header *ro_header,
struct bpf_binary_header *ro_header,
struct bpf_binary_header *rw_header) struct bpf_binary_header *rw_header)
{ {
void *ptr; void *ptr;
......
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