Linux CAN drivers development
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: "Ira W. Snyder" <iws@ovro.caltech.edu>
Cc: "linux-can@vger.kernel.org" <linux-can@vger.kernel.org>
Subject: Re: Janz ICAN3 build warnings
Date: Wed, 29 Jan 2014 20:14:15 +0100	[thread overview]
Message-ID: <52E95307.1030402@hartkopp.net> (raw)
In-Reply-To: <20140129175824.GC20561@ovro.caltech.edu>



On 29.01.2014 18:58, Ira W. Snyder wrote:
> From 90dd8d23b90d837d8d2bc5d53d0319b15f1db5a8 Mon Sep 17 00:00:00 2001
> From: "Ira W. Snyder" <iws@ovro.caltech.edu>
> Date: Wed, 29 Jan 2014 09:51:48 -0800
> Subject: [PATCH] can: janz-ican3: fix uninitialized variable warnings
> 
> Analysis of the code shows that the struct ican3_msg variable cannot be
> used uninitialized. Error conditions are checked and the loop terminates
> before calling the ican3_handle_message() function with an uninitialized
> value.
> 
> Signed-off-by: Ira W. Snyder <iws@ovro.caltech.edu>

Yes, that fixed it!

Thanks for your fast response!

Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>

> ---
> 
> Hi Oliver, it looks like GCC is being stupid here. The loop obviously
> terminates before calling ican3_handle_message(). Do you agree?
> 
> I can't reproduce these warnings. Can you apply this patch and see if it
> fixes the problem for your compiler version? If so, go ahead and apply
> it.
> 
> Thanks,
> Ira
> 
>  drivers/net/can/janz-ican3.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/can/janz-ican3.c b/drivers/net/can/janz-ican3.c
> index e24e6690d672..07f0ba03cd59 100644
> --- a/drivers/net/can/janz-ican3.c
> +++ b/drivers/net/can/janz-ican3.c
> @@ -1322,7 +1322,7 @@ static int ican3_napi(struct napi_struct *napi, int budget)
>  
>  	/* process all communication messages */
>  	while (true) {
> -		struct ican3_msg msg;
> +		struct ican3_msg uninitialized_var(msg);
>  		ret = ican3_recv_msg(mod, &msg);
>  		if (ret)
>  			break;
> 

  reply	other threads:[~2014-01-29 19:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-29 14:10 Janz ICAN3 build warnings Oliver Hartkopp
2014-01-29 17:58 ` Ira W. Snyder
2014-01-29 19:14   ` Oliver Hartkopp [this message]
2014-01-29 20:30   ` Marc Kleine-Budde

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=52E95307.1030402@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=iws@ovro.caltech.edu \
    --cc=linux-can@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox