Hello Andrii Nakryiko,
This is a semi-automatic email about new static checker warnings.
Commit c381203eadb7 ("selftests/bpf: add trusted global subprog arg tests") from Jan 29, 2024, leads to the following Smatch complaint:
./tools/testing/selftests/bpf/progs/verifier_global_ptr_args.c:88 trusted_task_arg_nonnull_fail2() warn: variable dereferenced before check 'nullable' (see line 86)
./tools/testing/selftests/bpf/progs/verifier_global_ptr_args.c 85 /* should fail, PTR_TO_BTF_ID_OR_NULL */ 86 res = subprog_trusted_task_nonnull(nullable); ^^^^^^^^ This is dereferenced
87 88 if (nullable) ^^^^^^^^ NULL check is too late
89 bpf_task_release(nullable); 90
regards, dan carpenter
On Fri, Aug 9, 2024 at 4:32 AM Dan Carpenter dan.carpenter@linaro.org wrote:
Hello Andrii Nakryiko,
This is a semi-automatic email about new static checker warnings.
Commit c381203eadb7 ("selftests/bpf: add trusted global subprog arg tests") from Jan 29, 2024, leads to the following Smatch complaint:
./tools/testing/selftests/bpf/progs/verifier_global_ptr_args.c:88 trusted_task_arg_nonnull_fail2() warn: variable dereferenced before check 'nullable' (see line 86)
./tools/testing/selftests/bpf/progs/verifier_global_ptr_args.c 85 /* should fail, PTR_TO_BTF_ID_OR_NULL */ 86 res = subprog_trusted_task_nonnull(nullable); ^^^^^^^^ This is dereferenced
this is intentional, it's testing that verifier will catch this mistake
87 88 if (nullable) ^^^^^^^^
NULL check is too late
89 bpf_task_release(nullable); 90
regards, dan carpenter
linux-kselftest-mirror@lists.linaro.org