* [bug report] selftests/bpf: specify expected instructions in test_verifier tests
@ 2023-06-06 8:31 Dan Carpenter
2023-06-06 21:18 ` Eduard Zingerman
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2023-06-06 8:31 UTC (permalink / raw)
To: eddyz87; +Cc: bpf
Hello Eduard Zingerman,
This is a semi-automatic email about new static checker warnings.
The patch 933ff53191eb: "selftests/bpf: specify expected instructions
in test_verifier tests" from Jun 21, 2022, leads to the following
Smatch complaint:
./tools/testing/selftests/bpf/test_verifier.c:1365 get_xlated_program()
warn: variable dereferenced before check 'buf' (see line 1364)
./tools/testing/selftests/bpf/test_verifier.c
1363 *cnt = xlated_prog_len / buf_element_size;
1364 *buf = calloc(*cnt, buf_element_size);
1365 if (!buf) {
This should be if (!*buf) {
1366 perror("can't allocate xlated program buffer");
1367 return -ENOMEM;
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [bug report] selftests/bpf: specify expected instructions in test_verifier tests
2023-06-06 8:31 [bug report] selftests/bpf: specify expected instructions in test_verifier tests Dan Carpenter
@ 2023-06-06 21:18 ` Eduard Zingerman
0 siblings, 0 replies; 2+ messages in thread
From: Eduard Zingerman @ 2023-06-06 21:18 UTC (permalink / raw)
To: Dan Carpenter; +Cc: bpf
On Tue, 2023-06-06 at 11:31 +0300, Dan Carpenter wrote:
> Hello Eduard Zingerman,
>
> This is a semi-automatic email about new static checker warnings.
>
> The patch 933ff53191eb: "selftests/bpf: specify expected instructions
> in test_verifier tests" from Jun 21, 2022, leads to the following
> Smatch complaint:
>
> ./tools/testing/selftests/bpf/test_verifier.c:1365 get_xlated_program()
> warn: variable dereferenced before check 'buf' (see line 1364)
>
> ./tools/testing/selftests/bpf/test_verifier.c
> 1363 *cnt = xlated_prog_len / buf_element_size;
> 1364 *buf = calloc(*cnt, buf_element_size);
> 1365 if (!buf) {
>
> This should be if (!*buf) {
>
> 1366 perror("can't allocate xlated program buffer");
> 1367 return -ENOMEM;
Hi Dan,
Thank you for this bug report, I'll submit a fixed version.
Thanks,
Eduard
>
> regards,
> dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-06-06 21:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-06 8:31 [bug report] selftests/bpf: specify expected instructions in test_verifier tests Dan Carpenter
2023-06-06 21:18 ` Eduard Zingerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox