bpf,arena: Use helper sizeof_field in struct accessors
PATCH 1/1 bpf,arena: Use helper sizeof_field in struct accessors
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 <[email protected]>
--- kernel/bpf/arena.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/arena.c +1 -1
@@ -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 {
Signature · 1 line
2.43.2
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:
Quoted 7 lines · 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 <[email protected]>--- 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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html