From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754706AbcKUORh (ORCPT ); Mon, 21 Nov 2016 09:17:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57128 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753075AbcKUORf (ORCPT ); Mon, 21 Nov 2016 09:17:35 -0500 Date: Mon, 21 Nov 2016 15:17:30 +0100 From: Benjamin Tissoires To: kbuild test robot Cc: kbuild-all@01.org, Jiri Kosina , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] HID: lg: fix noderef.cocci warnings Message-ID: <20161121141730.GI2119@mail.corp.redhat.com> References: <201611211942.OoqNaSxL%fengguang.wu@intel.com> <20161121120531.GA65643@xian.lkp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20161121120531.GA65643@xian.lkp.intel.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 21 Nov 2016 14:17:34 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Signed-off-by: Fengguang Wu > --- > > 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); > }