[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20130118.030341.2246222347501217868.davem@davemloft.net>
Date: Fri, 18 Jan 2013 03:03:41 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: jacmet@...site.dk
Cc: sque@...omium.org, netdev@...r.kernel.org, msb@...omium.org
Subject: Re: [PATCH] net: usb: initialize tmp in dm9601.c to avoid warning
From: Peter Korsgaard <jacmet@...site.dk>
Date: Fri, 18 Jan 2013 08:37:41 +0100
>>>>>> "David" == David Miller <davem@...emloft.net> writes:
>
> >> What warning and what compiler version are you using?
>
> David> I wouldn't bother asking this, unless it's so that you personally
> David> can reproduce this in the future.
>
> David> The compiler cannot determine with %100 certainty that tmp is
> David> initialized in all paths. Any time there are conditional
> David> statements guarding setting and the use, the compiler is going
> David> to err on the side of caution and say that if any of those
> David> paths lead to a use without a set it's going to warn.
>
> Sure, I just wondered as the code hasn't changed in 5+ years, and the
> function that gets called is defined just above, so the compiler should
> be able to figure it out.
Nothing guarentees that a piece of memory passed into an external
function has it's contents initialized completely by that function.
The compiler can't see what usbnet_read_cmd() does with the memory
behind the 'data' pointer argument. So it makes the only assumption
it can make, which is that 'tmp' might be uninitialized.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists