diff options
| author | Shung-Hsi Yu <[email protected]> | 2024-09-05 05:52:32 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <[email protected]> | 2024-09-05 20:29:06 +0000 |
| commit | 1ae497c78f01855f3695b58481311ffdd429b028 (patch) | |
| tree | 58ae167e4e4a488a8be8f43541869bdf34458d0c /net/bpf/bpf_dummy_struct_ops.c | |
| parent | Merge branch 'local-vmtest-enhancement-and-rv64-enabled' (diff) | |
| download | kernel-1ae497c78f01855f3695b58481311ffdd429b028.tar.gz kernel-1ae497c78f01855f3695b58481311ffdd429b028.zip | |
bpf: use type_may_be_null() helper for nullable-param check
Commit 980ca8ceeae6 ("bpf: check bpf_dummy_struct_ops program params for
test runs") does bitwise AND between reg_type and PTR_MAYBE_NULL, which
is correct, but due to type difference the compiler complains:
net/bpf/bpf_dummy_struct_ops.c:118:31: warning: bitwise operation between different enumeration types ('const enum bpf_reg_type' and 'enum bpf_type_flag') [-Wenum-enum-conversion]
118 | if (info && (info->reg_type & PTR_MAYBE_NULL))
| ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
Workaround the warning by moving the type_may_be_null() helper from
verifier.c into bpf_verifier.h, and reuse it here to check whether param
is nullable.
Fixes: 980ca8ceeae6 ("bpf: check bpf_dummy_struct_ops program params for test runs")
Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Signed-off-by: Shung-Hsi Yu <[email protected]>
Acked-by: Eduard Zingerman <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
Diffstat (limited to 'net/bpf/bpf_dummy_struct_ops.c')
| -rw-r--r-- | net/bpf/bpf_dummy_struct_ops.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/bpf/bpf_dummy_struct_ops.c b/net/bpf/bpf_dummy_struct_ops.c index 3ea52b05adfb..f71f67c6896b 100644 --- a/net/bpf/bpf_dummy_struct_ops.c +++ b/net/bpf/bpf_dummy_struct_ops.c @@ -115,7 +115,7 @@ static int check_test_run_args(struct bpf_prog *prog, struct bpf_dummy_ops_test_ offset = btf_ctx_arg_offset(bpf_dummy_ops_btf, func_proto, arg_no); info = find_ctx_arg_info(prog->aux, offset); - if (info && (info->reg_type & PTR_MAYBE_NULL)) + if (info && type_may_be_null(info->reg_type)) continue; return -EINVAL; |
