diff mbox series

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

Message ID 20220310161518.534544-1-ytcoode@gmail.com (mailing list archive)
State Accepted
Commit 1b773d0003aa90e60953d263c2ee31e6fb4a8a69
Delegated to: BPF
Headers show
Series [bpf-next] bpf: Use offsetofend() to simplify macro definition | expand

Checks

Context Check Description
bpf/vmtest-bpf-next success VM_Test
netdev/tree_selection success Clearly marked for bpf-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 20 this patch: 20
netdev/cc_maintainers success CCed 10 of 10 maintainers
netdev/build_clang success Errors and warnings before: 18 this patch: 18
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 25 this patch: 25
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
bpf/vmtest-bpf-next-PR fail PR summary

Commit Message

Yuntao Wang March 10, 2022, 4:15 p.m. UTC
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(-)

Comments

Yonghong Song March 10, 2022, 4:24 p.m. UTC | #1
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>
Joanne Koong March 10, 2022, 9:51 p.m. UTC | #2
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
[...]
patchwork-bot+netdevbpf@kernel.org March 10, 2022, 10:10 p.m. UTC | #3
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!
diff mbox series

Patch

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,