mirror of
https://github.com/torvalds/linux.git
synced 2026-01-25 15:03:52 +08:00
selftests/bpf: Fix realloc size in bpf_get_addrs
We will segfault once we call realloc in bpf_get_addrs due to
wrong size argument.
Fixes: 6302bdeb91 ("selftests/bpf: Add a kprobe_multi subtest to use addrs instead of syms")
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
committed by
Alexei Starovoitov
parent
4b2b38ea20
commit
0c342bfc99
@@ -732,7 +732,7 @@ int bpf_get_addrs(unsigned long **addrsp, size_t *cntp, bool kernel)
|
||||
|
||||
if (cnt == max_cnt) {
|
||||
max_cnt += inc_cnt;
|
||||
tmp_addrs = realloc(addrs, max_cnt);
|
||||
tmp_addrs = realloc(addrs, max_cnt * sizeof(long));
|
||||
if (!tmp_addrs) {
|
||||
err = -ENOMEM;
|
||||
goto error;
|
||||
|
||||
Reference in New Issue
Block a user