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-next>] [day] [month] [year] [list]
Message-ID: <cfdbe504c7ed3964bef22c551f0c78c048ce3d2d.camel@perches.com>
Date:   Fri, 28 May 2021 14:35:01 -0700
From:   Joe Perches <joe@...ches.com>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
Cc:     Jonathan Cameron <jic23@...nel.org>,
        Nathan Chancellor <nathan@...nel.org>,
        Arnd Bergmann <arnd@...nel.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Maxime Roussin-Bélanger 
        <maxime.roussinbelanger@...il.com>,
        Jean-Francois Dagenais <jeff.dagenais@...il.com>,
        Arnd Bergmann <arnd@...db.de>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Alexandru Ardelean <alexandru.ardelean@...log.com>,
        "linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "clang-built-linux@...glegroups.com" 
        <clang-built-linux@...glegroups.com>
Subject: Re: [PATCH] iio: si1133: fix format string warnings

On Sat, 2021-05-29 at 00:16 +0300, Andy Shevchenko wrote:
> On Saturday, May 29, 2021, Joe Perches <joe@...ches.com> wrote:
[]
> > > > Likely these should be 0x%02x
> > > 
> > > What’s the difference (except printing 0)?
> > 
> > (assuming the argument is unsigned char/u8)
> > 
> > %#02x will always emit more than the specified length (3 or 4 chars)
> > values < 16 are 0x<hexdigit>, values >= 16 are 0x<hexdigit><hexdigit>
> 
> 0 will be 0, btw.

Hey Andy.  Right.

> > 0x%02x will always emit 4 chars
> 
> *Minimum* or at least 4 characters. There is an upper limit of sizeof(int)
> * 2 + 2.

I did write assuming the argument is unsigned char/u8.
For the general unsigned int arg case, you are of course correct.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ