* [PATCH v1] bpf,arena: Use helper sizeof_field in struct accessors
@ 2024-03-27 6:53 Haiyue Wang
2024-03-27 16:30 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Haiyue Wang @ 2024-03-27 6:53 UTC (permalink / raw)
To: bpf
Cc: Haiyue Wang, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Martin KaFai Lau, Eduard Zingerman, Song Liu, Yonghong Song,
John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
open list
Use the well defined helper sizeof_field() to calculate the size of a
struct member, instead of doing custom calculations.
Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
---
kernel/bpf/arena.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/bpf/arena.c b/kernel/bpf/arena.c
index 86571e760dd6..af5cae640669 100644
--- a/kernel/bpf/arena.c
+++ b/kernel/bpf/arena.c
@@ -37,7 +37,7 @@
*/
/* number of bytes addressable by LDX/STX insn with 16-bit 'off' field */
-#define GUARD_SZ (1ull << sizeof(((struct bpf_insn *)0)->off) * 8)
+#define GUARD_SZ (1ull << sizeof_field(struct bpf_insn, off) * 8)
#define KERN_VM_SZ ((1ull << 32) + GUARD_SZ)
struct bpf_arena {
--
2.43.2
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH v1] bpf,arena: Use helper sizeof_field in struct accessors
2024-03-27 6:53 [PATCH v1] bpf,arena: Use helper sizeof_field in struct accessors Haiyue Wang
@ 2024-03-27 16:30 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-03-27 16:30 UTC (permalink / raw)
To: Haiyue Wang
Cc: bpf, ast, daniel, andrii, martin.lau, eddyz87, song,
yonghong.song, john.fastabend, kpsingh, sdf, haoluo, jolsa,
linux-kernel
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:
On Wed, 27 Mar 2024 14:53:29 +0800 you wrote:
> Use the well defined helper sizeof_field() to calculate the size of a
> struct member, instead of doing custom calculations.
>
> Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
> ---
> kernel/bpf/arena.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Here is the summary with links:
- [v1] bpf,arena: Use helper sizeof_field in struct accessors
https://git.kernel.org/bpf/bpf-next/c/45a683b2d815
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:[~2024-03-27 16:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-27 6:53 [PATCH v1] bpf,arena: Use helper sizeof_field in struct accessors Haiyue Wang
2024-03-27 16:30 ` 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