[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPhsuW6apm_oL+9JZ3o7b1hq+7O7-9X-FAHt_oy1BOk_o6VWRQ@mail.gmail.com>
Date: Wed, 29 Jul 2020 21:20:51 -0700
From: Song Liu <song@...nel.org>
To: Andrii Nakryiko <andriin@...com>
Cc: bpf <bpf@...r.kernel.org>, Networking <netdev@...r.kernel.org>,
Alexei Starovoitov <ast@...com>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii.nakryiko@...il.com>,
Kernel Team <kernel-team@...com>,
Song Liu <songliubraving@...com>
Subject: Re: [PATCH bpf-next] libbpf: make destructors more robust by handling
ERR_PTR(err) cases
On Wed, Jul 29, 2020 at 4:22 PM Andrii Nakryiko <andriin@...com> wrote:
>
> 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@...com>
> Signed-off-by: Andrii Nakryiko <andriin@...com>
Acked-by: Song Liu <songliubraving@...com>
Powered by blists - more mailing lists