Skip to content

Commit

Permalink
bpf,arena: Use helper sizeof_field in struct accessors
Browse files Browse the repository at this point in the history
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>
Link: https://lore.kernel.org/r/20240327065334.8140-1-haiyue.wang@intel.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
  • Loading branch information
haiyuewa authored and Alexei Starovoitov committed Mar 27, 2024
1 parent 4c91c59 commit 45a683b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/bpf/arena.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 45a683b

Please sign in to comment.