Skip to content

Commit

Permalink
Input: ff-core - silence an underflow warning
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
  • Loading branch information
Dan Carpenter authored and Dmitry Torokhov committed Sep 29, 2015
1 parent b83b145 commit 379d7cf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/input/ff-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 > 0xffffU)
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 > 0xffffU)
break;

ff->set_autocenter(dev, value);
Expand Down

0 comments on commit 379d7cf

Please sign in to comment.