]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Use libbpf_mem_ensure() when allocating new map
authorAndrii Nakryiko <andrii@kernel.org>
Thu, 28 Apr 2022 04:15:21 +0000 (21:15 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 29 Apr 2022 03:03:29 +0000 (20:03 -0700)
commitf7740ecf5bcdb45406eca1533aefd401aed293db
tree6d6592563e6ffba0093926826f57b73c99a17cf3
parent862b19e82fa39a9e5c6ac8c72d8b4c678925ba0f
libbpf: Use libbpf_mem_ensure() when allocating new map

Reuse libbpf_mem_ensure() when adding a new map to the list of maps
inside bpf_object. It takes care of proper resizing and reallocating of
map array and zeroing out newly allocated memory.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20220428041523.4089853-3-andrii@kernel.org
tools/lib/bpf/libbpf.c