All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin KaFai Lau <kafai@fb.com>
To: Benedict Schlueter <Benedict.Schlueter@rub.de>
Cc: <bpf@vger.kernel.org>, <benedict.schlueter@ruhr-uni-bochum.de>
Subject: Re: fix u32 printf specifier
Date: Thu, 3 Jun 2021 23:27:44 -0700	[thread overview]
Message-ID: <20210604062744.rivtnhbdopb6jtzt@kafai-mbp> (raw)
In-Reply-To: <2d11fecc-4999-73d7-82e7-3a2c9d9826f3@rub.de>

On Thu, Jun 03, 2021 at 12:41:57AM +0200, Benedict Schlueter wrote:
> On 02/06/2021 19:41, Martin KaFai Lau wrote:
> 
> > On Wed, Jun 02, 2021 at 05:23:19PM +0200, Benedict Schlueter wrote:
> > > Hi,
> > > 
> > > I assume its clear what this patch does.
> > > 
> > > 
> > >  From 9618e4475b812651c3fe481af885757675fc4ae2 Mon Sep 17 00:00:00 2001
> > > From: Benedict Schlueter <benedict.schlueter@rub.de>
> > > Date: Wed, 2 Jun 2021 17:16:13 +0200
> > > Subject: use correct format string specifier for unsigned 32 Bit
> > >   bounds print statements
> > > 
> > > Signed-off-by: Benedict Schlueter <benedict.schlueter@rub.de>
> > > ---
> > >   kernel/bpf/verifier.c | 4 ++--
> > >   1 file changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> > > index 1de4b8c6ee42..e107996c7220 100644
> > > --- a/kernel/bpf/verifier.c
> > > +++ b/kernel/bpf/verifier.c
> > > @@ -690,11 +690,11 @@ static void print_verifier_state(struct
> > > bpf_verifier_env *env,
> > >                           (int)(reg->s32_max_value));
> > >                   if (reg->u32_min_value != reg->umin_value &&
> > >                       reg->u32_min_value != U32_MIN)
> > > -                    verbose(env, ",u32_min_value=%d",
> > > +                    verbose(env, ",u32_min_value=%u",
> > >                           (int)(reg->u32_min_value));
> > "%u" and (int) cast don't make sense.
> Yep, changed to unsigned int for consistency with the other cases. Is this
> necessary? Since reg->u32_min_value is already a unsigned 32 bit number.
cast is unnecessary.

> > It needs a proper commit message to explain why the change is needed
> > and also a Fixes tag.  Please refer to Documentation/bpf/bpf_devel_QA.rst.
> 
> Sorry should have read this more carefully before. Everything should be
> included right now.
> 
> From fd076dc5f2bd5ec4e9cb49530e77cf2d3e4f42c2 Mon Sep 17 00:00:00 2001
> From: Benedict Schlueter <benedict.schlueter@rub.de>
> Date: Wed, 2 Jun 2021 21:42:39 +0200
> Subject: [PATCH bpf-next]
>  use correct format string specifier for unsigned 32 bounds
> 
> when printing an unsigned value, it should be a positive number
> 
> verifier log before the patch
> ([...],s32_max_value=-2,u32_min_value=-16,u32_max_value=-2)
> 
> verifier log after the patch
> ([...],s32_max_value=-2,u32_min_value=4294967280,u32_max_value=4294967294)
> 
> 
> fixes 3f50f132d840 (bpf: Verifier, do explicit ALU32 bounds tracking)
Fixes: 3f50f132d840 ("bpf: Verifier, do explicit ALU32 bounds tracking")

which can be obtained by:
git log -1 --format='Fixes: %h ("%s")' 3f50f132d840

      parent reply	other threads:[~2021-06-04  6:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-02 15:23 fix u32 printf specifier Benedict Schlueter
2021-06-02 17:41 ` Martin KaFai Lau
2021-06-02 22:41   ` Benedict Schlueter
2021-06-03 23:58     ` Alexei Starovoitov
2021-06-04  6:27     ` Martin KaFai Lau [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=20210604062744.rivtnhbdopb6jtzt@kafai-mbp \
    --to=kafai@fb.com \
    --cc=Benedict.Schlueter@rub.de \
    --cc=benedict.schlueter@ruhr-uni-bochum.de \
    --cc=bpf@vger.kernel.org \
    /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.