linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Fengguang Wu <lkp@intel.com>
Cc: Jiri Kosina <jikos@kernel.org>,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>,
	kbuild-all@01.org, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Gilles Muller <Gilles.Muller@lip6.fr>
Subject: Re: [PATCH] HID: lg: fix noderef.cocci warnings
Date: Wed, 23 Nov 2016 08:03:51 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.20.1611230802320.2037@hadrien> (raw)
In-Reply-To: <20161123022231.dnvneqc7jrvzv7zp@wfg-t540p.sh.intel.com>



On Wed, 23 Nov 2016, Fengguang Wu wrote:

> 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. :)

Thanks for forwarding.  From looking at the code snippet, I have the
impression that if it were possible, it would require an interprocedural
analysis, and the cost would outweigh the benefit.  Basically, I don't see
any cbuf nearby.

julia


> > > 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
>

  reply	other threads:[~2016-11-23  7:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-21 10:48 [PATCH 0/4] HID: fix few non-DMA capable HID transfers Benjamin Tissoires
2016-11-21 10:48 ` [PATCH 1/4] HID: cp2112: make transfer buffers DMA capable Benjamin Tissoires
2016-11-21 10:48 ` [PATCH 2/4] HID: lg: " Benjamin Tissoires
2016-11-21 12:05   ` [PATCH] HID: lg: fix noderef.cocci warnings kbuild test robot
2016-11-21 14:17     ` Benjamin Tissoires
2016-11-22 10:44       ` Jiri Kosina
2016-11-23  2:22         ` Fengguang Wu
2016-11-23  7:03           ` Julia Lawall [this message]
2016-11-21 12:05   ` [PATCH 2/4] HID: lg: make transfer buffers DMA capable kbuild test robot
2016-11-21 10:48 ` [PATCH 3/4] HID: magicmouse: " Benjamin Tissoires
2016-11-21 10:48 ` [PATCH 4/4] HID: rmi: " Benjamin Tissoires
2016-11-23 16:44 ` [PATCH 0/4] HID: fix few non-DMA capable HID transfers Jiri Kosina

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1611230802320.2037@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=Gilles.Muller@lip6.fr \
    --cc=benjamin.tissoires@redhat.com \
    --cc=jikos@kernel.org \
    --cc=kbuild-all@01.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).