linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] Input: ff-core - silence an underflow warning
Date: Tue, 29 Sep 2015 16:12:58 +0300	[thread overview]
Message-ID: <20150929131258.GC7340@mwanda> (raw)
In-Reply-To: <20150929002830.GD30653@dtor-ws>

On Mon, Sep 28, 2015 at 05:28:30PM -0700, Dmitry Torokhov wrote:
> On Tue, Sep 22, 2015 at 04:26:43PM +0300, Dan Carpenter wrote:
> > My static checker complains that "value" comes from the user in
> > evdev_do_ioctl() and we check that it's not too large here but we don't
> > check that it's negative.  It's harmless because the ->set_gain() and
> > ->set_autocenter() functions truncate it to a valid u16 value, but we
> > may as well fix it just to make the static checker happy.
> > 
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > diff --git a/drivers/input/ff-core.c b/drivers/input/ff-core.c
> > index c642082..6a94c5f 100644
> > --- a/drivers/input/ff-core.c
> > +++ b/drivers/input/ff-core.c
> > @@ -273,14 +273,14 @@ int input_ff_event(struct input_dev *dev, unsigned int type,
> >  
> >  	switch (code) {
> >  	case FF_GAIN:
> > -		if (!test_bit(FF_GAIN, dev->ffbit) || value > 0xffff)
> > +		if (!test_bit(FF_GAIN, dev->ffbit) || value > 0xffffUL)
> >  			break;
> >  
> >  		ff->set_gain(dev, value);
> >  		break;
> >  
> >  	case FF_AUTOCENTER:
> > -		if (!test_bit(FF_AUTOCENTER, dev->ffbit) || value > 0xffff)
> > +		if (!test_bit(FF_AUTOCENTER, dev->ffbit) || value > 0xffffUL)
> 
> Why UL and not U?
> 

You're right.  That could just be U.  I'll resend.

regards,
dan carpenter


  reply	other threads:[~2015-09-29 13:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-22 13:26 [patch] Input: ff-core - silence an underflow warning Dan Carpenter
2015-09-29  0:28 ` Dmitry Torokhov
2015-09-29 13:12   ` Dan Carpenter [this message]
2015-09-29 23:03     ` Dmitry Torokhov
2015-10-02  6:07       ` Dan Carpenter

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=20150929131258.GC7340@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    /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).