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  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]
Date:   Thu, 28 Feb 2019 15:05:34 -0800
From:   Joe Perches <joe@...ches.com>
To:     Jon Flatley <jflat@...omium.org>
Cc:     Louis Taylor <louis@...gniz.eu>, gregkh@...uxfoundation.org,
        linux-usb@...r.kernel.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        clang-built-linux@...glegroups.com,
        Nick Desaulniers <ndesaulniers@...gle.com>
Subject: Re: [PATCH v2] wusb: use correct format characters

On Thu, 2019-02-28 at 14:23 -0800, Jon Flatley wrote:
> Thanks for the patch and comments.
> 
> On Thu, Feb 28, 2019 at 1:53 PM Joe Perches <joe@...ches.com> wrote:
> > On Thu, 2019-02-28 at 12:24 +0000, Louis Taylor wrote:
> > > When compiling with -Wformat, clang warns:
> > > ./include/linux/usb/wusb.h:245:5: warning: format specifies type
> > > 'unsigned short' but the argument has type 'u8' (aka 'unsigned char')
> > > [-Wformat]
> > >   ckhdid->data[0],  ckhdid->data[1],
> > >   ^~~~~~~~~~~~~~~
> > 
> > I think the message is somewhat misguided as all the
> > vararg arguments have implicit integer promotions.
> 
> That's a fair point, but Clang checks the arguments against their
> format specifier before they're promoted when using -Wformat.

Perhaps clang could be a bit more verbose if
checking signed types emitted as unsigned or
unsigned types emitted as signed instead.

> When
> considering integer promotions it's difficult to say if this is
> "wrong",

I didn't write "wrong", I wrote misguided.

> but since 'unsigned char' corresponds to the "hh" length
> specifier I don't think this is misguided. Otherwise, why use the "h"
> length specifier at all?

e.g.: signed char as %x needs %hhx

cheers, Joe

Powered by blists - more mailing lists