All of lore.kernel.org
 help / color / mirror / Atom feed
From: Song Liu <song@kernel.org>
To: "Mauricio Vásquez" <mauricio@kinvolk.io>
Cc: Networking <netdev@vger.kernel.org>, bpf <bpf@vger.kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Quentin Monnet <quentin@isovalent.com>
Subject: Re: [PATCH bpf-next 1/2] libbpf: Use IS_ERR_OR_NULL() in hashmap__free()
Date: Fri, 7 Jan 2022 09:40:20 -0800	[thread overview]
Message-ID: <CAPhsuW5ueryw6195bvR=eMZpCXdYjsyMyO_kKwjFBz4BiC6cag@mail.gmail.com> (raw)
In-Reply-To: <20220107152620.192327-1-mauricio@kinvolk.io>

On Fri, Jan 7, 2022 at 7:26 AM Mauricio Vásquez <mauricio@kinvolk.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@kinvolk.io>

Acked-by: Song Liu <songliubraving@fb.com>

  parent reply	other threads:[~2022-01-07 17:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-07 15:26 [PATCH bpf-next 1/2] libbpf: Use IS_ERR_OR_NULL() in hashmap__free() Mauricio Vásquez
2022-01-07 15:26 ` [PATCH bpf-next 2/2] bpftool: Fix error check when calling hashmap__new() Mauricio Vásquez
2022-01-07 18:02   ` Quentin Monnet
2022-01-07 18:51   ` Song Liu
2022-01-07 17:40 ` Song Liu [this message]
2022-01-07 22:00 ` [PATCH bpf-next 1/2] libbpf: Use IS_ERR_OR_NULL() in hashmap__free() patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPhsuW5ueryw6195bvR=eMZpCXdYjsyMyO_kKwjFBz4BiC6cag@mail.gmail.com' \
    --to=song@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=mauricio@kinvolk.io \
    --cc=netdev@vger.kernel.org \
    --cc=quentin@isovalent.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.