All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <natechancellor@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Wolfgang Grandegger <wg@grandegger.com>,
	Marc Kleine-Budde <mkl@pengutronix.de>,
	"David S. Miller" <davem@davemloft.net>,
	Nick Desaulniers <ndesaulniers@google.com>,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	linux-can@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] peak_usb: fix clang build warning
Date: Thu, 7 Mar 2019 08:31:43 -0700	[thread overview]
Message-ID: <20190307153143.GI20201@archlinux-ryzen> (raw)
In-Reply-To: <20190307103219.1539316-1-arnd@arndb.de>

On Thu, Mar 07, 2019 at 11:31:55AM +0100, Arnd Bergmann wrote:
> Clang points out undefined behavior when building the pcan_usb_pro driver:
> 
> drivers/net/can/usb/peak_usb/pcan_usb_pro.c:136:15: error: passing an object that undergoes default argument promotion to 'va_start' has undefined behavior [-Werror,-Wvarargs]
> 
> Changing the function prototype to avoid argument promotion in the
> varargs call avoids the warning, and should make this well-defined.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Link: https://github.com/ClangBuiltLinux/linux/issues/109
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>

I wonder if the format specifier in the pr_err statement at the end of
this function should be updated.

> ---
>  drivers/net/can/usb/peak_usb/pcan_usb_pro.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
> index d516def846ab..b388406ac0f5 100644
> --- a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
> +++ b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
> @@ -127,7 +127,7 @@ static u8 *pcan_msg_init_empty(struct pcan_usb_pro_msg *pm,
>  /*
>   * add one record to a message being built
>   */
> -static int pcan_msg_add_rec(struct pcan_usb_pro_msg *pm, u8 id, ...)
> +static int pcan_msg_add_rec(struct pcan_usb_pro_msg *pm, int id, ...)
>  {
>  	int len, i;
>  	u8 *pc;
> -- 
> 2.20.0
> 

  reply	other threads:[~2019-03-07 15:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-07 10:31 [PATCH] peak_usb: fix clang build warning Arnd Bergmann
2019-03-07 15:31 ` Nathan Chancellor [this message]
2019-03-07 15:38   ` Arnd Bergmann
2019-03-07 17:40 ` David Miller

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=20190307153143.GI20201@archlinux-ryzen \
    --to=natechancellor@gmail.com \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=gustavo@embeddedor.com \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=ndesaulniers@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=wg@grandegger.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.