Thread (19 messages) 19 messages, 3 authors, 2017-05-30

Re: [PATCH v2 1/5] HID: intel_ish-hid: fix potential uninitialized data usage

From: Arnd Bergmann <arnd@arndb.de>
Date: 2017-05-24 08:33:03
Also in: lkml

On Wed, May 24, 2017 at 12:24 AM, Srinivas Pandruvada
[off-list ref] wrote:
On Thu, 2017-05-18 at 22:21 +0200, Arnd Bergmann wrote:
quoted
gcc points out an uninialized pointer dereference that could happen
if we ever get to recv_ishtp_cl_msg_dma() or recv_ishtp_cl_msg()
with an empty &dev->read_list:
In that case complete_rb should be NULL and it should not go to

if (complete_rb) {

shouldn't enter and cl is not dereferenced.

So not sure why is this warning.
Correct. Unfortunately gcc cannot track this for complex functions, as
figuring this out is a not a solvable problem in general. I think in this
particular case, it gives up either because of the multiple 'goto' and
'continue' statements inside of the loop that get in the way of a full
analysis, or the 'spin_unlock_irqrestore' makes it forget the state.
I've seen both in the past.

However, just like gcc gets confused easily, a human reader trying
to understand the function will have the same issue, so my workaround
also helps there.

        Arnd
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help