* [PATCH bpf-next v1] bpf: Use BPF_CALL_IMM macro consistently in bpf_do_misc_fixups
@ 2026-07-01 3:51 Tiezhu Yang
2026-07-01 20:10 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Tiezhu Yang @ 2026-07-01 3:51 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Eduard Zingerman, Kumar Kartikeya Dwivedi, Martin KaFai Lau,
Song Liu, Yonghong Song, Jiri Olsa, Emil Tsalapatis, KaFai Wan
Cc: bpf, linux-kernel
In bpf_do_misc_fixups(), the conversion from a function address to a
BPF immediate value is handled using the BPF_CALL_IMM macro inside the
'patch_map_ops_generic' label block. However, immediately following it
in the 'patch_call_imm' label block, the immediate value is calculated
manually by subtracting __bpf_call_base from fn->func.
Inspired by KaFai Wan's review comments on fixing helper call offsets,
use the BPF_CALL_IMM macro in 'patch_call_imm' as well to clean this up.
This removes the redundant manual pointer arithmetic and ensures coding
style consistency across adjacent label blocks within the same function.
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
kernel/bpf/fixups.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/bpf/fixups.c b/kernel/bpf/fixups.c
index 3cf2cc6e3ab6..12a8a4eb757f 100644
--- a/kernel/bpf/fixups.c
+++ b/kernel/bpf/fixups.c
@@ -2338,7 +2338,7 @@ int bpf_do_misc_fixups(struct bpf_verifier_env *env)
func_id_name(insn->imm), insn->imm);
return -EFAULT;
}
- insn->imm = fn->func - __bpf_call_base;
+ insn->imm = BPF_CALL_IMM(fn->func);
next_insn:
if (subprogs[cur_subprog + 1].start == i + delta + 1) {
subprogs[cur_subprog].stack_depth += stack_depth_extra;
--
2.42.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH bpf-next v1] bpf: Use BPF_CALL_IMM macro consistently in bpf_do_misc_fixups
2026-07-01 3:51 [PATCH bpf-next v1] bpf: Use BPF_CALL_IMM macro consistently in bpf_do_misc_fixups Tiezhu Yang
@ 2026-07-01 20:10 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-07-01 20:10 UTC (permalink / raw)
To: Tiezhu Yang
Cc: ast, daniel, andrii, eddyz87, memxor, martin.lau, song,
yonghong.song, jolsa, emil, kafai.wan, bpf, linux-kernel
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:
On Wed, 1 Jul 2026 11:51:07 +0800 you wrote:
> In bpf_do_misc_fixups(), the conversion from a function address to a
> BPF immediate value is handled using the BPF_CALL_IMM macro inside the
> 'patch_map_ops_generic' label block. However, immediately following it
> in the 'patch_call_imm' label block, the immediate value is calculated
> manually by subtracting __bpf_call_base from fn->func.
>
> Inspired by KaFai Wan's review comments on fixing helper call offsets,
> use the BPF_CALL_IMM macro in 'patch_call_imm' as well to clean this up.
> This removes the redundant manual pointer arithmetic and ensures coding
> style consistency across adjacent label blocks within the same function.
>
> [...]
Here is the summary with links:
- [bpf-next,v1] bpf: Use BPF_CALL_IMM macro consistently in bpf_do_misc_fixups
https://git.kernel.org/bpf/bpf-next/c/475b59db3bd5
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] 2+ messages in thread
end of thread, other threads:[~2026-07-01 20:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-01 3:51 [PATCH bpf-next v1] bpf: Use BPF_CALL_IMM macro consistently in bpf_do_misc_fixups Tiezhu Yang
2026-07-01 20:10 ` 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