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


Groups > linux.kernel > #1528140

Re: [PATCH] HID: lg: fix noderef.cocci warnings

From Fengguang Wu <lkp@intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH] HID: lg: fix noderef.cocci warnings
Date 2016-11-23 07:00 +0100
Message-ID <sGyL7-Jb-5@gated-at.bofh.it> (permalink)
References <sFVA5-11d-3@gated-at.bofh.it> <sFVA5-11d-7@gated-at.bofh.it> <sFXBT-2h6-25@gated-at.bofh.it> <sGgOd-61X-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Nov 22, 2016 at 11:44:34AM +0100, Jiri Kosina wrote:
>On Mon, 21 Nov 2016, Benjamin Tissoires wrote:
>
>> > Generated by: scripts/coccinelle/misc/noderef.cocci
>> >
>> > CC: Benjamin Tissoires <benjamin.tissoires@redhat.com>
>> > Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
>> > ---
>> >
>> >  hid-lg.c |    6 ++++--
>> >  1 file changed, 4 insertions(+), 2 deletions(-)
>> >
>> > --- a/drivers/hid/hid-lg.c
>> > +++ b/drivers/hid/hid-lg.c
>> > @@ -777,8 +777,10 @@ static int lg_probe(struct hid_device *h
>> >  			buf[1] = 0xB2;
>> >  			get_random_bytes(&buf[2], 2);
>> >
>> > -			ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(buf),
>> > -					HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
>> > +			ret = hid_hw_raw_request(hdev, buf[0], buf,
>> > +						 sizeof(*buf),
>>
>> This is wrong. I messed up and should have used "sizeof(cbuf)", but the
>> coccinelle script failed at detecting the correct solution (I guess it
>> couldn't).
>
>Fengguang, is there anything that could be done to improve this?

CC Julie and Gilles. I'm not sure if the coccinelle script could be
made that smart. :)

>> Jiri, do you want me to send a v2 of the series or will you just amend
>> the patch while applying?
>
>I'll fix that up, no worries. Thanks,
>
>-- 
>Jiri Kosina
>SUSE Labs

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


Thread

[PATCH 0/4] HID: fix few non-DMA capable HID transfers Benjamin Tissoires <benjamin.tissoires@redhat.com> - 2016-11-21 11:50 +0100
  [PATCH 3/4] HID: magicmouse: make transfer buffers DMA capable Benjamin Tissoires <benjamin.tissoires@redhat.com> - 2016-11-21 11:50 +0100
  [PATCH 1/4] HID: cp2112: make transfer buffers DMA capable Benjamin Tissoires <benjamin.tissoires@redhat.com> - 2016-11-21 11:50 +0100
  [PATCH 2/4] HID: lg: make transfer buffers DMA capable Benjamin Tissoires <benjamin.tissoires@redhat.com> - 2016-11-21 11:50 +0100
    [PATCH] HID: lg: fix noderef.cocci warnings kbuild test robot <lkp@intel.com> - 2016-11-21 13:10 +0100
      Re: [PATCH] HID: lg: fix noderef.cocci warnings Benjamin Tissoires <benjamin.tissoires@redhat.com> - 2016-11-21 15:20 +0100
        Re: [PATCH] HID: lg: fix noderef.cocci warnings Jiri Kosina <jikos@kernel.org> - 2016-11-22 11:50 +0100
          Re: [PATCH] HID: lg: fix noderef.cocci warnings Fengguang Wu <lkp@intel.com> - 2016-11-23 07:00 +0100
            Re: [PATCH] HID: lg: fix noderef.cocci warnings Julia Lawall <julia.lawall@lip6.fr> - 2016-11-23 08:10 +0100
    Re: [PATCH 2/4] HID: lg: make transfer buffers DMA capable kbuild test robot <lkp@intel.com> - 2016-11-21 13:10 +0100
  [PATCH 4/4] HID: rmi: make transfer buffers DMA capable Benjamin Tissoires <benjamin.tissoires@redhat.com> - 2016-11-21 11:50 +0100
  Re: [PATCH 0/4] HID: fix few non-DMA capable HID transfers Jiri Kosina <jikos@kernel.org> - 2016-11-23 17:50 +0100

csiph-web