[PATCH bpf-next] bpf: Use offsetofend() to simplify macro definition

Subsystems: bpf [core], bpf [general] (safe dynamic programs and tools), the rest

STALE1640d LANDED

Landed in mainline as 1b773d0003aa on 2022-03-10.

4 messages, 4 authors, 2022-03-10 · open the first message on its own page

[PATCH bpf-next] bpf: Use offsetofend() to simplify macro definition

From: Yuntao Wang <hidden>
Date: 2022-03-10 16:15:46

Use offsetofend() instead of offsetof() + sizeof() to simplify
MIN_BPF_LINEINFO_SIZE macro definition.

Signed-off-by: Yuntao Wang <redacted>
---
 kernel/bpf/verifier.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index e34264200e09..0db6cd8dcb35 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -10400,8 +10400,7 @@ static void adjust_btf_func(struct bpf_verifier_env *env)
 		aux->func_info[i].insn_off = env->subprog_info[i].start;
 }
 
-#define MIN_BPF_LINEINFO_SIZE	(offsetof(struct bpf_line_info, line_col) + \
-		sizeof(((struct bpf_line_info *)(0))->line_col))
+#define MIN_BPF_LINEINFO_SIZE	offsetofend(struct bpf_line_info, line_col)
 #define MAX_LINEINFO_REC_SIZE	MAX_FUNCINFO_REC_SIZE
 
 static int check_btf_line(struct bpf_verifier_env *env,
-- 
2.35.1

Re: [PATCH bpf-next] bpf: Use offsetofend() to simplify macro definition

From: Yonghong Song <hidden>
Date: 2022-03-10 16:25:05


On 3/10/22 8:15 AM, Yuntao Wang wrote:
Use offsetofend() instead of offsetof() + sizeof() to simplify
MIN_BPF_LINEINFO_SIZE macro definition.

Signed-off-by: Yuntao Wang <redacted>
Acked-by: Yonghong Song <redacted>

Re: [PATCH bpf-next] bpf: Use offsetofend() to simplify macro definition

From: Joanne Koong <joannelkoong@gmail.com>
Date: 2022-03-10 21:52:14

On Thu, Mar 10, 2022 at 1:15 PM Yuntao Wang [off-list ref] wrote:
Use offsetofend() instead of offsetof() + sizeof() to simplify
MIN_BPF_LINEINFO_SIZE macro definition.

Signed-off-by: Yuntao Wang <redacted>
Acked-by: Joanne Koong <joannelkoong@gmail.com>
quoted hunk
---
 kernel/bpf/verifier.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
[...]

Re: [PATCH bpf-next] bpf: Use offsetofend() to simplify macro definition

From: patchwork-bot+netdevbpf@kernel.org
Date: 2022-03-10 22:10:21

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Daniel Borkmann [off-list ref]:

On Fri, 11 Mar 2022 00:15:18 +0800 you wrote:
Use offsetofend() instead of offsetof() + sizeof() to simplify
MIN_BPF_LINEINFO_SIZE macro definition.

Signed-off-by: Yuntao Wang <redacted>
---
 kernel/bpf/verifier.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Here is the summary with links:
  - [bpf-next] bpf: Use offsetofend() to simplify macro definition
    https://git.kernel.org/bpf/bpf-next/c/1b773d0003aa

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help