Hello Andrii Nakryiko,
This is a semi-automatic email about new static checker warnings.
Commit 8863238993e2 ("selftests/bpf: BPF register range bounds tester") from Nov 11, 2023, leads to the following Smatch complaint:
./tools/testing/selftests/bpf/prog_tests/reg_bounds.c:1121 parse_reg_state() warn: variable dereferenced before check 'p' (see line 1119)
./tools/testing/selftests/bpf/prog_tests/reg_bounds.c 1118 p = strpbrk(p, ",)"); 1119 if (*p == ')') 1120 break; 1121 if (p)
Was this NULL check supposed to be checking for the NUL terminator?
1122 p++; 1123 }
regards, dan carpenter
On Fri, Aug 9, 2024 at 4:23 AM Dan Carpenter dan.carpenter@linaro.org wrote:
Hello Andrii Nakryiko,
This is a semi-automatic email about new static checker warnings.
Commit 8863238993e2 ("selftests/bpf: BPF register range bounds tester") from Nov 11, 2023, leads to the following Smatch complaint:
./tools/testing/selftests/bpf/prog_tests/reg_bounds.c:1121 parse_reg_state() warn: variable dereferenced before check 'p' (see line 1119)
./tools/testing/selftests/bpf/prog_tests/reg_bounds.c 1118 p = strpbrk(p, ",)"); 1119 if (*p == ')') 1120 break; 1121 if (p)
Was this NULL check supposed to be checking for the NUL terminator?
yeah, looks like a bug, it probably should be `if (p && *p == ')') break;`. Are you planning to send the fix to bpf@vger.kernel.org?
1122 p++; 1123 }
regards, dan carpenter
On Fri, Aug 09, 2024 at 10:19:54AM -0700, Andrii Nakryiko wrote:
On Fri, Aug 9, 2024 at 4:23 AM Dan Carpenter dan.carpenter@linaro.org wrote:
Hello Andrii Nakryiko,
This is a semi-automatic email about new static checker warnings.
Commit 8863238993e2 ("selftests/bpf: BPF register range bounds tester") from Nov 11, 2023, leads to the following Smatch complaint:
./tools/testing/selftests/bpf/prog_tests/reg_bounds.c:1121 parse_reg_state() warn: variable dereferenced before check 'p' (see line 1119)
./tools/testing/selftests/bpf/prog_tests/reg_bounds.c 1118 p = strpbrk(p, ",)"); 1119 if (*p == ')') 1120 break; 1121 if (p)
Was this NULL check supposed to be checking for the NUL terminator?
yeah, looks like a bug, it probably should be `if (p && *p == ')') break;`. Are you planning to send the fix to bpf@vger.kernel.org?
No, sorry. I send drive by one liners, but BPF is too much of a headache to deal with if you're not a regular BPFer. Plus these days I have so little time that I send way more bug reports than patches...
regards, dan carpenter
linux-kselftest-mirror@lists.linaro.org