]> www.infradead.org Git - users/jedix/linux-maple.git/commit
libbpf: Use proper errno value in nlattr
authorAnton Protopopov <a.s.protopopov@gmail.com>
Sat, 10 May 2025 18:20:11 +0000 (18:20 +0000)
committerAndrii Nakryiko <andrii@kernel.org>
Mon, 12 May 2025 22:22:54 +0000 (15:22 -0700)
commitfd5fd538a1f4b34cee6823ba0ddda2f7a55aca96
tree72801ead899ad1396711449b9b8606f050545779
parent3a320ed325488d07081461663ac9243293006080
libbpf: Use proper errno value in nlattr

Return value of the validate_nla() function can be propagated all the
way up to users of libbpf API. In case of error this libbpf version
of validate_nla returns -1 which will be seen as -EPERM from user's
point of view. Instead, return a more reasonable -EINVAL.

Fixes: bbf48c18ee0c ("libbpf: add error reporting in XDP")
Suggested-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Anton Protopopov <a.s.protopopov@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20250510182011.2246631-1-a.s.protopopov@gmail.com
tools/lib/bpf/nlattr.c