]> 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)
commit77b16adc4374aeca2782b4ebc24b8a1429774dcd
tree6d6592563e6ffba0093926826f57b73c99a17cf3
parenta860d09a275ff66ab8e4bbf9bd567996b5b460b5
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