From: Jules Irenge <jbi.octave@gmail.com>
To: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
john.fastabend@gmail.com, ast@kernel.org
Subject: Re: [PATCH 1/2] bpf: Fix warning of Using plain integer as NULL pointer
Date: Sun, 4 Sep 2022 11:36:41 +0100 [thread overview]
Message-ID: <YxR/uSCd9fPWbR55@playground> (raw)
In-Reply-To: <CAP01T750UfvnrS7pc6t5_z6P8xH6iPh_66X_fsAgidBqwsbdXQ@mail.gmail.com>
On Sat, Sep 03, 2022 at 09:10:31PM +0200, Kumar Kartikeya Dwivedi wrote:
> On Sat, 3 Sept 2022 at 20:59, Jules Irenge <jbi.octave@gmail.com> wrote:
> >
> > This patch fixes a warning generated by Sparse
> >
> > "Using plain integer as NULL pointer"
> >
> > by replacing the offending 0 by NULL.
> >
> > Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
> > ---
> > kernel/bpf/syscall.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
> > index 27760627370d..427b7e3829e0 100644
> > --- a/kernel/bpf/syscall.c
> > +++ b/kernel/bpf/syscall.c
> > @@ -598,7 +598,7 @@ void bpf_map_free_kptrs(struct bpf_map *map, void *map_value)
> > if (off_desc->type == BPF_KPTR_UNREF) {
> > u64 *p = (u64 *)btf_id_ptr;
> >
> > - WRITE_ONCE(p, 0);
> > + WRITE_ONCE(p, NULL);
>
> Uff, this should have been WRITE_ONCE(*p, 0) instead. Mea Culpa.
> Can you make that fix? It's not a big problem since it's just that the
> pointer won't be cleared on map value delete (and there is nothing to
> reclaim for the unref case when map is freed), so you can target
> bpf-next with a Fixes tag.
> So in your patch you will need [PATCH bpf-next] in the subject and the
> fixes tag would be:
> Fixes: 14a324f6a67e ("bpf: Wire up freeing of referenced kptr")
Thanks, already done. if there is anything I miss, please let me know. I am on a learning
journey.
Jules
prev parent reply other threads:[~2022-09-04 10:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-03 18:56 [PATCH 1/2] bpf: Fix warning of Using plain integer as NULL pointer Jules Irenge
2022-09-03 19:10 ` Kumar Kartikeya Dwivedi
2022-09-04 10:36 ` Jules Irenge [this message]
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=YxR/uSCd9fPWbR55@playground \
--to=jbi.octave@gmail.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=john.fastabend@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=memxor@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox