From: Stephen Hemminger <stephen@networkplumber.org>
To: Baruch Siach <baruch@tkos.co.il>
Cc: Jiri Pirko <jiri@mellanox.com>,
netdev@vger.kernel.org, Aya Levin <ayal@mellanox.com>,
Moshe Shemesh <moshe@mellanox.com>
Subject: Re: [PATCH iproute2 1/2] devlink: fix format string warning for 32bit targets
Date: Wed, 26 Jun 2019 07:55:49 -0700 [thread overview]
Message-ID: <20190626075549.58dbab66@hermes.lan> (raw)
In-Reply-To: <20190626033044.jmsejzopzj3wgl5f@sapphire.tkos.co.il>
On Wed, 26 Jun 2019 06:30:44 +0300
Baruch Siach <baruch@tkos.co.il> wrote:
> Hi Stephen,
>
> On Tue, Jun 25, 2019 at 11:58:06AM -0700, Stephen Hemminger wrote:
> > On Tue, 25 Jun 2019 14:49:04 +0300
> > Baruch Siach <baruch@tkos.co.il> wrote:
> >
> > > diff --git a/devlink/devlink.c b/devlink/devlink.c
> > > index 436935f88bda..b400fab17578 100644
> > > --- a/devlink/devlink.c
> > > +++ b/devlink/devlink.c
> > > @@ -1726,9 +1726,9 @@ static void pr_out_u64(struct dl *dl, const char *name, uint64_t val)
> > > jsonw_u64_field(dl->jw, name, val);
> > > } else {
> > > if (g_indent_newline)
> > > - pr_out("%s %lu", name, val);
> > > + pr_out("%s %llu", name, val);
> > > else
> > > - pr_out(" %s %lu", name, val);
> > > + pr_out(" %s %llu", name, val);
> >
> > But on 64 bit target %llu expects unsigned long long which is 128bit.
>
> Is that a problem?
>
> > The better way to fix this is to use:
> > #include <inttypes.h>
> >
> > And the use the macro PRIu64
> > pr_out(" %s %"PRIu64, name, val);
>
> I think it makes the code harder to read. But OK, I'll post an update to this
> patch and the next.
Or cast val to unsigned long long?
the real problem is devlink's macro's for printing.
If I had been paying attention during initial review, would have forced pr_out to be
a function.
prev parent reply other threads:[~2019-06-26 14:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-25 11:49 [PATCH iproute2 1/2] devlink: fix format string warning for 32bit targets Baruch Siach
2019-06-25 11:49 ` [PATCH iproute2 2/2] devlink: fix libc and kernel headers collision Baruch Siach
2019-06-25 18:59 ` Stephen Hemminger
2019-06-25 18:58 ` [PATCH iproute2 1/2] devlink: fix format string warning for 32bit targets Stephen Hemminger
2019-06-26 3:30 ` Baruch Siach
2019-06-26 14:55 ` Stephen Hemminger [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=20190626075549.58dbab66@hermes.lan \
--to=stephen@networkplumber.org \
--cc=ayal@mellanox.com \
--cc=baruch@tkos.co.il \
--cc=jiri@mellanox.com \
--cc=moshe@mellanox.com \
--cc=netdev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).