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


Groups > linux.kernel > #1526701

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

From Benjamin Tissoires <benjamin.tissoires@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH] HID: lg: fix noderef.cocci warnings
Date 2016-11-21 15:20 +0100
Message-ID <sFXBT-2h6-25@gated-at.bofh.it> (permalink)
References <sFVA5-11d-3@gated-at.bofh.it> <sFVA5-11d-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Nov 21 2016 or thereabouts, kbuild test robot wrote:
> drivers/hid/hid-lg.c:780:47-53: ERROR: application of sizeof to pointer
> 
>  sizeof when applied to a pointer typed expression gives the size of
>  the pointer
> 
> 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).

Jiri, do you want me to send a v2 of the series or will you just amend
the patch while applying?

Cheers,
Benjamin

> +						 HID_FEATURE_REPORT,
> +						 HID_REQ_SET_REPORT);
>  		}
>  		kfree(buf);
>  	}

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