[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPhsuW5ueryw6195bvR=eMZpCXdYjsyMyO_kKwjFBz4BiC6cag@mail.gmail.com>
Date: Fri, 7 Jan 2022 09:40:20 -0800
From: Song Liu <song@...nel.org>
To: Mauricio Vásquez <mauricio@...volk.io>
Cc: Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Quentin Monnet <quentin@...valent.com>
Subject: Re: [PATCH bpf-next 1/2] libbpf: Use IS_ERR_OR_NULL() in hashmap__free()
On Fri, Jan 7, 2022 at 7:26 AM Mauricio Vásquez <mauricio@...volk.io> wrote:
>
> hashmap__new() uses ERR_PTR() to return an error so it's better to
> use IS_ERR_OR_NULL() in order to check the pointer before calling
> free(). This will prevent freeing an invalid pointer if somebody calls
> hashmap__free() with the result of a failed hashmap__new() call.
>
> Signed-off-by: Mauricio Vásquez <mauricio@...volk.io>
Acked-by: Song Liu <songliubraving@...com>
Powered by blists - more mailing lists