summaryrefslogtreecommitdiff
path: root/net/ipv4
diff options
context:
space:
mode:
authorAndrii Nakryiko <andriin@fb.com>2020-07-30 02:21:48 +0300
committerDaniel Borkmann <daniel@iogearbox.net>2020-07-31 01:53:07 +0300
commit50450fc716c1a570ee8d8bfe198ef5d3cfca36e4 (patch)
tree081623f21697f9919d3120b820ddea93f776ceab /net/ipv4
parenta6599abdeac30063baf89df166068b20758e0e86 (diff)
downloadlinux-50450fc716c1a570ee8d8bfe198ef5d3cfca36e4.tar.xz
libbpf: Make destructors more robust by handling ERR_PTR(err) cases
Most of libbpf "constructors" on failure return ERR_PTR(err) result encoded as a pointer. It's a common mistake to eventually pass such malformed pointers into xxx__destroy()/xxx__free() "destructors". So instead of fixing up clean up code in selftests and user programs, handle such error pointers in destructors themselves. This works beautifully for NULL pointers passed to destructors, so might as well just work for error pointers. Suggested-by: Song Liu <songliubraving@fb.com> Signed-off-by: Andrii Nakryiko <andriin@fb.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Song Liu <songliubraving@fb.com> Link: https://lore.kernel.org/bpf/20200729232148.896125-1-andriin@fb.com
Diffstat (limited to 'net/ipv4')
0 files changed, 0 insertions, 0 deletions