mirror of
https://github.com/torvalds/linux.git
synced 2026-06-03 03:53:37 +02:00
selftests/bpf: Fix possible NULL passed to memcpy() with zero size
Prevent sanitizer from complaining about passing NULL into memcpy(), even if it happens with zero size. Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20211124002325.1737739-9-andrii@kernel.org
This commit is contained in:
parent
486e648cb2
commit
3bd0233f38
|
|
@ -881,7 +881,8 @@ void test_core_reloc(void)
|
|||
data = mmap_data;
|
||||
|
||||
memset(mmap_data, 0, sizeof(*data));
|
||||
memcpy(data->in, test_case->input, test_case->input_len);
|
||||
if (test_case->input_len)
|
||||
memcpy(data->in, test_case->input, test_case->input_len);
|
||||
data->my_pid_tgid = my_pid_tgid;
|
||||
|
||||
link = bpf_program__attach_raw_tracepoint(prog, tp_name);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user