* [PATCH bpf-next] bpf: Remove unnecessary err < 0 check in bpf_struct_ops_map_update_elem
@ 2024-03-15 19:21 Martin KaFai Lau
2024-03-15 20:32 ` Stanislav Fomichev
2024-03-18 19:50 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Martin KaFai Lau @ 2024-03-15 19:21 UTC (permalink / raw)
To: bpf
Cc: Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann, kernel-team,
Kui-Feng Lee
From: Martin KaFai Lau <martin.lau@kernel.org>
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.
Cc: Kui-Feng Lee <thinker.li@gmail.com>
Fixes: 187e2af05abe ("bpf: struct_ops supports more than one page for trampolines.")
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
---
kernel/bpf/bpf_struct_ops.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/kernel/bpf/bpf_struct_ops.c b/kernel/bpf/bpf_struct_ops.c
index 43356faaa057..3fcd35314ce5 100644
--- a/kernel/bpf/bpf_struct_ops.c
+++ b/kernel/bpf/bpf_struct_ops.c
@@ -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();
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH bpf-next] bpf: Remove unnecessary err < 0 check in bpf_struct_ops_map_update_elem
2024-03-15 19:21 [PATCH bpf-next] bpf: Remove unnecessary err < 0 check in bpf_struct_ops_map_update_elem Martin KaFai Lau
@ 2024-03-15 20:32 ` Stanislav Fomichev
2024-03-18 19:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Stanislav Fomichev @ 2024-03-15 20:32 UTC (permalink / raw)
To: Martin KaFai Lau
Cc: bpf, Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann,
kernel-team, Kui-Feng Lee
On 03/15, Martin KaFai Lau wrote:
> From: Martin KaFai Lau <martin.lau@kernel.org>
>
> 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.
>
> Cc: Kui-Feng Lee <thinker.li@gmail.com>
> Fixes: 187e2af05abe ("bpf: struct_ops supports more than one page for trampolines.")
> Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Acked-by: Stanislav Fomichev <sdf@google.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH bpf-next] bpf: Remove unnecessary err < 0 check in bpf_struct_ops_map_update_elem
2024-03-15 19:21 [PATCH bpf-next] bpf: Remove unnecessary err < 0 check in bpf_struct_ops_map_update_elem Martin KaFai Lau
2024-03-15 20:32 ` Stanislav Fomichev
@ 2024-03-18 19:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-03-18 19:50 UTC (permalink / raw)
To: Martin KaFai Lau; +Cc: bpf, ast, andrii, daniel, kernel-team, thinker.li
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:
On Fri, 15 Mar 2024 12:21:12 -0700 you wrote:
> From: Martin KaFai Lau <martin.lau@kernel.org>
>
> 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.
>
> [...]
Here is the summary with links:
- [bpf-next] bpf: Remove unnecessary err < 0 check in bpf_struct_ops_map_update_elem
https://git.kernel.org/bpf/bpf-next/c/7f3edd0c72c3
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-03-18 19:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-15 19:21 [PATCH bpf-next] bpf: Remove unnecessary err < 0 check in bpf_struct_ops_map_update_elem Martin KaFai Lau
2024-03-15 20:32 ` Stanislav Fomichev
2024-03-18 19:50 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox