lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190626033044.jmsejzopzj3wgl5f@sapphire.tkos.co.il>
Date:   Wed, 26 Jun 2019 06:30:44 +0300
From:   Baruch Siach <baruch@...s.co.il>
To:     Stephen Hemminger <stephen@...workplumber.org>
Cc:     Jiri Pirko <jiri@...lanox.com>, netdev@...r.kernel.org,
        Aya Levin <ayal@...lanox.com>,
        Moshe Shemesh <moshe@...lanox.com>
Subject: Re: [PATCH iproute2 1/2] devlink: fix format string warning for
 32bit targets

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@...s.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.

Thanks,
baruch

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@...s.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ