All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Louis Taylor <louis@kragniz.eu>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	clang-built-linux@googlegroups.com, ndesaulniers@google.com,
	jflat@chromium.org
Subject: wusb: use correct format characters
Date: Thu, 28 Feb 2019 12:59:17 +0100	[thread overview]
Message-ID: <20190228115917.GA2825@kroah.com> (raw)

On Thu, Feb 28, 2019 at 11:52:56AM +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],
>   ^~~~~~~~~~~~~~~
> 
> ckhdid->data is unconditionally defined as `u8 data[16]`, so this patch
> updates the format characters to the correct one for unsigned char types.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/378
> Signed-off-by: Louis Taylor <louis@kragniz.eu>
> ---
>  include/linux/usb/wusb.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/usb/wusb.h b/include/linux/usb/wusb.h
> index 9e4a3213f2c2..0a3cdf10972d 100644
> --- a/include/linux/usb/wusb.h
> +++ b/include/linux/usb/wusb.h
> @@ -240,8 +240,8 @@ static inline size_t ckhdid_printf(char *pr_ckhdid, size_t size,
>  				   const struct wusb_ckhdid *ckhdid)
>  {
>  	return scnprintf(pr_ckhdid, size,
> -			 "%02hx %02hx %02hx %02hx %02hx %02hx %02hx %02hx "
> -			 "%02hx %02hx %02hx %02hx %02hx %02hx %02hx %02hx",
> +			 "%02hhu %02hhu %02hhu %02hhu %02hhu %02hhu %02hhu %02hhu "
> +			 "%02hhu %02hhu %02hhu %02hhu %02hhu %02hhu %02hhu %02hhu",

Why did you switch from hex to decimal in the output format?  That feels
very wrong to me.

greg k-h

WARNING: multiple messages have this Message-ID (diff)
From: Greg KH <gregkh@linuxfoundation.org>
To: Louis Taylor <louis@kragniz.eu>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	clang-built-linux@googlegroups.com, ndesaulniers@google.com,
	jflat@chromium.org
Subject: Re: [PATCH] wusb: use correct format characters
Date: Thu, 28 Feb 2019 12:59:17 +0100	[thread overview]
Message-ID: <20190228115917.GA2825@kroah.com> (raw)
In-Reply-To: <20190228115256.5446-1-louis@kragniz.eu>

On Thu, Feb 28, 2019 at 11:52:56AM +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],
>   ^~~~~~~~~~~~~~~
> 
> ckhdid->data is unconditionally defined as `u8 data[16]`, so this patch
> updates the format characters to the correct one for unsigned char types.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/378
> Signed-off-by: Louis Taylor <louis@kragniz.eu>
> ---
>  include/linux/usb/wusb.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/usb/wusb.h b/include/linux/usb/wusb.h
> index 9e4a3213f2c2..0a3cdf10972d 100644
> --- a/include/linux/usb/wusb.h
> +++ b/include/linux/usb/wusb.h
> @@ -240,8 +240,8 @@ static inline size_t ckhdid_printf(char *pr_ckhdid, size_t size,
>  				   const struct wusb_ckhdid *ckhdid)
>  {
>  	return scnprintf(pr_ckhdid, size,
> -			 "%02hx %02hx %02hx %02hx %02hx %02hx %02hx %02hx "
> -			 "%02hx %02hx %02hx %02hx %02hx %02hx %02hx %02hx",
> +			 "%02hhu %02hhu %02hhu %02hhu %02hhu %02hhu %02hhu %02hhu "
> +			 "%02hhu %02hhu %02hhu %02hhu %02hhu %02hhu %02hhu %02hhu",

Why did you switch from hex to decimal in the output format?  That feels
very wrong to me.

greg k-h

             reply	other threads:[~2019-02-28 11:59 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-28 11:59 Greg Kroah-Hartman [this message]
2019-02-28 11:59 ` [PATCH] wusb: use correct format characters Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2019-03-05 16:28 Test
2019-03-05 16:28 ` [PATCH] " Test
2019-03-05 16:21 Test
2019-03-05 16:21 ` [PATCH] " Test
2019-03-01 19:54 wusb: Remove unnecessary static function ckhdid_printf Greg Kroah-Hartman
2019-03-01 19:54 ` [PATCH] " Greg KH
2019-03-01 18:18 Nick Desaulniers
2019-03-01 18:18 ` [PATCH] " Nick Desaulniers
2019-03-01 11:15 Louis Taylor
2019-03-01 11:15 ` [PATCH] " Louis Taylor
2019-03-01  4:38 Joe Perches
2019-03-01  4:38 ` [PATCH] " Joe Perches
2019-03-01  0:03 [v2] wusb: use correct format characters Jon Flatley
2019-03-01  0:03 ` [PATCH v2] " Jon Flatley
2019-02-28 23:05 [v2] " Joe Perches
2019-02-28 23:05 ` [PATCH v2] " Joe Perches
2019-02-28 22:23 [v2] " Jon Flatley
2019-02-28 22:23 ` [PATCH v2] " Jon Flatley
2019-02-28 21:53 [v2] " Joe Perches
2019-02-28 21:53 ` [PATCH v2] " Joe Perches
2019-02-28 19:19 [v2] " Nick Desaulniers
2019-02-28 19:19 ` [PATCH v2] " Nick Desaulniers
2019-02-28 12:24 [v2] " Louis Taylor
2019-02-28 12:24 ` [PATCH v2] " Louis Taylor
2019-02-28 11:52 Louis Taylor
2019-02-28 11:52 ` [PATCH] " Louis Taylor

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=20190228115917.GA2825@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=clang-built-linux@googlegroups.com \
    --cc=jflat@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=louis@kragniz.eu \
    --cc=ndesaulniers@google.com \
    /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.