Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1647416

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

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject Re: [PATCH v2 1/5] HID: intel_ish-hid: fix potential uninitialized data usage
Date 2017-05-22 23:40 +0200
Message-ID <tK3dw-2wK-11@gated-at.bofh.it> (permalink)
References <tIAdz-8oW-3@gated-at.bofh.it> <tIAdA-8oW-27@gated-at.bofh.it> <tK122-1cI-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, May 22, 2017 at 9:17 PM, Srinivas Pandruvada
<srinivas.pandruvada@linux.intel.com> wrote:
> Hi Arnd,
> On Thu, 2017-05-18 at 22:21 +0200, Arnd Bergmann wrote:
>> 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:
>>
>> drivers/hid/intel-ish-hid/ishtp/client.c: In function
>> 'recv_ishtp_cl_msg_dma':
>> drivers/hid/intel-ish-hid/ishtp/client.c:1049:3: error: 'cl' may be
>> used uninitialized in this function [-Werror=maybe-uninitialized]
>>
>> The warning only appeared in very few randconfig builds, as the
>> spinlocks tend to prevent gcc from tracing the variables. I only
>> saw it in configurations that had neither SMP nor LOCKDEP enabled.
>>
>> As we can see, we only enter the case if 'complete_rb' is non-NULL,
>> and then 'cl' is known to point to complete_rb->cl. Adding another
>> initialization to the same pointer is harmless here and makes it
>> clear to the compiler that the behavior is well-defined.
>>
> Did you get chance to test these changes on a platform with ISH?

No, I only build-tested it and though about the fix carefully.

        Arnd

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

HID: intel_ish-hid: various cleanups Arnd Bergmann <arnd@arndb.de> - 2017-05-18 22:30 +0200
  [PATCH v2 4/5] HID: intel_ish-hid: fix format string for size_t Arnd Bergmann <arnd@arndb.de> - 2017-05-18 22:30 +0200
    Re: [PATCH v2 4/5] HID: intel_ish-hid: fix format string for size_t Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> - 2017-05-23 01:50 +0200
      Re: [PATCH v2 4/5] HID: intel_ish-hid: fix format string for size_t Arnd Bergmann <arnd@arndb.de> - 2017-05-23 10:40 +0200
  [PATCH v2 3/5] HID: intel_ish-hid: convert timespec to ktime_t Arnd Bergmann <arnd@arndb.de> - 2017-05-18 22:30 +0200
  [PATCH v2 1/5] HID: intel_ish-hid: fix potential uninitialized data usage Arnd Bergmann <arnd@arndb.de> - 2017-05-18 22:30 +0200
    Re: [PATCH v2 1/5] HID: intel_ish-hid: fix potential uninitialized  data usage Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> - 2017-05-22 21:20 +0200
      Re: [PATCH v2 1/5] HID: intel_ish-hid: fix potential uninitialized  data usage Arnd Bergmann <arnd@arndb.de> - 2017-05-22 23:40 +0200
    Re: [PATCH v2 1/5] HID: intel_ish-hid: fix potential uninitialized  data usage Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> - 2017-05-24 00:30 +0200
      Re: [PATCH v2 1/5] HID: intel_ish-hid: fix potential uninitialized  data usage Arnd Bergmann <arnd@arndb.de> - 2017-05-24 10:40 +0200

csiph-web