BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next] bpf: Use offsetofend() to simplify macro definition
@ 2022-03-10 16:15 Yuntao Wang
  2022-03-10 16:24 ` Yonghong Song
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Yuntao Wang @ 2022-03-10 16:15 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko
  Cc: Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, netdev, bpf, linux-kernel, Yuntao Wang

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

Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH bpf-next] bpf: Use offsetofend() to simplify macro definition
  2022-03-10 16:15 [PATCH bpf-next] bpf: Use offsetofend() to simplify macro definition Yuntao Wang
@ 2022-03-10 16:24 ` Yonghong Song
  2022-03-10 21:51 ` Joanne Koong
  2022-03-10 22:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Yonghong Song @ 2022-03-10 16:24 UTC (permalink / raw)
  To: Yuntao Wang, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko
  Cc: Martin KaFai Lau, Song Liu, John Fastabend, KP Singh, netdev, bpf,
	linux-kernel



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 <ytcoode@gmail.com>

Acked-by: Yonghong Song <yhs@fb.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH bpf-next] bpf: Use offsetofend() to simplify macro definition
  2022-03-10 16:15 [PATCH bpf-next] bpf: Use offsetofend() to simplify macro definition Yuntao Wang
  2022-03-10 16:24 ` Yonghong Song
@ 2022-03-10 21:51 ` Joanne Koong
  2022-03-10 22:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Joanne Koong @ 2022-03-10 21:51 UTC (permalink / raw)
  To: Yuntao Wang
  Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, netdev, bpf, linux-kernel

On Thu, Mar 10, 2022 at 1:15 PM Yuntao Wang <ytcoode@gmail.com> wrote:
>
> Use offsetofend() instead of offsetof() + sizeof() to simplify
> MIN_BPF_LINEINFO_SIZE macro definition.
>
> Signed-off-by: Yuntao Wang <ytcoode@gmail.com>

Acked-by: Joanne Koong <joannelkoong@gmail.com>

> ---
>  kernel/bpf/verifier.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
[...]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH bpf-next] bpf: Use offsetofend() to simplify macro definition
  2022-03-10 16:15 [PATCH bpf-next] bpf: Use offsetofend() to simplify macro definition Yuntao Wang
  2022-03-10 16:24 ` Yonghong Song
  2022-03-10 21:51 ` Joanne Koong
@ 2022-03-10 22:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-03-10 22:10 UTC (permalink / raw)
  To: Yuntao Wang
  Cc: ast, daniel, andrii, kafai, songliubraving, yhs, john.fastabend,
	kpsingh, netdev, bpf, linux-kernel

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:

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 <ytcoode@gmail.com>
> ---
>  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



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-03-10 22:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-10 16:15 [PATCH bpf-next] bpf: Use offsetofend() to simplify macro definition Yuntao Wang
2022-03-10 16:24 ` Yonghong Song
2022-03-10 21:51 ` Joanne Koong
2022-03-10 22:10 ` 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