]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Don't call libc APIs with NULL pointers
authorAndrii Nakryiko <andrii@kernel.org>
Wed, 24 Nov 2021 00:23:16 +0000 (16:23 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 25 Nov 2021 23:15:02 +0000 (00:15 +0100)
commitc343b686b3ed001d3f34d7fd5a7cc5257271daf0
treeb542fe70eedb6b9914aa75d2aa61373779a79a84
parent7e4dc11e60a743e7d475e4a48b8b5d0653972ef8
libbpf: Don't call libc APIs with NULL pointers

Sanitizer complains about qsort(), bsearch(), and memcpy() being called
with NULL pointer. This can only happen when the associated number of
elements is zero, so no harm should be done. But still prevent this from
happening to keep sanitizer runs clean from extra noise.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20211124002325.1737739-5-andrii@kernel.org
tools/lib/bpf/libbpf.c