Skip to content

Commit 45a683b

Browse files
Haiyue WangAlexei Starovoitov
authored andcommitted
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]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 4c91c59 commit 45a683b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/bpf/arena.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*/
3838

3939
/* number of bytes addressable by LDX/STX insn with 16-bit 'off' field */
40-
#define GUARD_SZ (1ull << sizeof(((struct bpf_insn *)0)->off) * 8)
40+
#define GUARD_SZ (1ull << sizeof_field(struct bpf_insn, off) * 8)
4141
#define KERN_VM_SZ ((1ull << 32) + GUARD_SZ)
4242

4343
struct bpf_arena {

0 commit comments

Comments
 (0)