]> www.infradead.org Git - users/jedix/linux-maple.git/commit
libbpf: Deal with section with no data gracefully
authorShung-Hsi Yu <shung-hsi.yu@suse.com>
Wed, 12 Oct 2022 02:23:52 +0000 (10:23 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:32:02 +0000 (13:32 +0100)
commite0f5361d95aab1c36af5fc9f57f44287623d8d73
tree9c43d8bba7726b7f36d7821397241a368b8da770
parent622ff59742fe7bf53c06a57332040fa0e08b8242
libbpf: Deal with section with no data gracefully

[ Upstream commit 35a855509e6ee3442477c8ebc6827b5b5d32a7b5 ]

ELF section data pointer returned by libelf may be NULL (if section has
SHT_NOBITS), so null check section data pointer before attempting to
copy license and kversion section.

Fixes: cb1e5e961991 ("bpf tools: Collect version and license from ELF sections")
Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20221012022353.7350-3-shung-hsi.yu@suse.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/lib/bpf/libbpf.c