Skip to content

Commit

Permalink
bpf: Remove unnecessary err < 0 check in bpf_struct_ops_map_update_elem
Browse files Browse the repository at this point in the history
There is a "if (err)" check earlier, so the "if (err < 0)"
check that this patch removing is unnecessary. It was my overlook
when making adjustments to the bpf_struct_ops_prepare_trampoline()
such that the caller does not have to worry about the new page when
the function returns error.

Fixes: 187e2af ("bpf: struct_ops supports more than one page for trampolines.")
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Stanislav Fomichev <sdf@google.com>
Link: https://lore.kernel.org/bpf/20240315192112.2825039-1-martin.lau@linux.dev
  • Loading branch information
Martin KaFai Lau authored and anakryiko committed Mar 18, 2024
1 parent 4c8644f commit 7f3edd0
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions kernel/bpf/bpf_struct_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -728,8 +728,6 @@ static long bpf_struct_ops_map_update_elem(struct bpf_map *map, void *key,
cur_image = image;
trampoline_start = 0;
}
if (err < 0)
goto reset_unlock;

*(void **)(kdata + moff) = image + trampoline_start + cfi_get_offset();

Expand Down

0 comments on commit 7f3edd0

Please sign in to comment.