diff options
author | Eduard Zingerman <eddyz87@gmail.com> | 2023-06-10 01:16:37 +0300 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2023-06-12 18:10:25 +0300 |
commit | b23ed4d74c4d583b5f621ee4c776699442833554 (patch) | |
tree | 4d0d2883149bc766afe71b0f0355dd77dadd2892 /tools/perf/scripts/python/export-to-postgresql.py | |
parent | 67faabbde36b7dc006cb0a71811098e7277976d0 (diff) | |
download | linux-b23ed4d74c4d583b5f621ee4c776699442833554.tar.xz |
selftests/bpf: Fix invalid pointer check in get_xlated_program()
Dan Carpenter reported invalid check for calloc() result in
test_verifier.c:get_xlated_program():
./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;
This commit refactors the get_xlated_program() to avoid using double
pointer type.
Fixes: 933ff53191eb ("selftests/bpf: specify expected instructions in test_verifier tests")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Closes: https://lore.kernel.org/bpf/ZH7u0hEGVB4MjGZq@moroto/
Link: https://lore.kernel.org/bpf/20230609221637.2631800-1-eddyz87@gmail.com
Diffstat (limited to 'tools/perf/scripts/python/export-to-postgresql.py')
0 files changed, 0 insertions, 0 deletions