From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754330AbcKWF5Z (ORCPT ); Wed, 23 Nov 2016 00:57:25 -0500 Received: from mga02.intel.com ([134.134.136.20]:64576 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750991AbcKWF5V (ORCPT ); Wed, 23 Nov 2016 00:57:21 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,684,1473145200"; d="scan'208";a="904622497" Date: Wed, 23 Nov 2016 10:22:31 +0800 From: Fengguang Wu To: Jiri Kosina Cc: Benjamin Tissoires , kbuild-all@01.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Julia Lawall , Gilles Muller Subject: Re: [PATCH] HID: lg: fix noderef.cocci warnings Message-ID: <20161123022231.dnvneqc7jrvzv7zp@wfg-t540p.sh.intel.com> References: <201611211942.OoqNaSxL%fengguang.wu@intel.com> <20161121120531.GA65643@xian.lkp.intel.com> <20161121141730.GI2119@mail.corp.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20161104 (1.7.1) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >> > 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). > >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