* [patch] Input: ff-core - silence an underflow warning
@ 2015-09-22 13:26 Dan Carpenter
2015-09-29 0:28 ` Dmitry Torokhov
0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2015-09-22 13:26 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, kernel-janitors
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)
break;
ff->set_autocenter(dev, value);
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [patch] Input: ff-core - silence an underflow warning
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
0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Torokhov @ 2015-09-29 0:28 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-input, kernel-janitors
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?
Thanks.
> break;
>
> ff->set_autocenter(dev, value);
--
Dmitry
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] Input: ff-core - silence an underflow warning
2015-09-29 0:28 ` Dmitry Torokhov
@ 2015-09-29 13:12 ` Dan Carpenter
2015-09-29 23:03 ` Dmitry Torokhov
0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2015-09-29 13:12 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, kernel-janitors
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] Input: ff-core - silence an underflow warning
2015-09-29 13:12 ` Dan Carpenter
@ 2015-09-29 23:03 ` Dmitry Torokhov
2015-10-02 6:07 ` Dan Carpenter
0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Torokhov @ 2015-09-29 23:03 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-input, kernel-janitors
On Tue, Sep 29, 2015 at 04:12:58PM +0300, Dan Carpenter wrote:
> 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.
That's fine, I'll adjust on my side.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] Input: ff-core - silence an underflow warning
2015-09-29 23:03 ` Dmitry Torokhov
@ 2015-10-02 6:07 ` Dan Carpenter
0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2015-10-02 6:07 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, kernel-janitors
On Tue, Sep 29, 2015 at 04:03:15PM -0700, Dmitry Torokhov wrote:
> That's fine, I'll adjust on my side.
Thanks!
regards,
dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-10-02 6:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2015-09-29 23:03 ` Dmitry Torokhov
2015-10-02 6:07 ` Dan Carpenter
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).