Input: ff-core - silence an underflow warning
Subsystems (3)
PATCH 1/1 Input: ff-core - silence an underflow warning
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.
drivers/input/ff-core.c +2 -2
@@ -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);
Dmitry Torokhov
maintainerQuoted 16 lines · Dan Carpenter
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 <[email protected]>drivers/input/ff-core.c +0
-0@@ -273,14 +273,14 @@ int input_ff_event(struct input_dev *dev, unsigned int type,switch (code) {case FF_GAIN :
drivers/input/ff-core.c int input_ff_event(struct input_dev *dev, unsigned int type, · line 283
Quoted 10 lines
drivers/input/ff-core.c +2
-2-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.
Quoted 3 lines
drivers/input/ff-core.c +0
-0break ; ff->set_autocenter (dev, value);
Signature · 1 line
Dmitry
Quoted 21 lines · Dmitry Torokhov
Quoted 20 lines · Dan Carpenter
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 <[email protected]>drivers/input/ff-core.c +1
-1@@ -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 ;
Quoted 9 lines
drivers/input/ff-core.c int input_ff_event(struct input_dev *dev, unsigned int type, · line 283
Quoted 6 lines
drivers/input/ff-core.c +1
-1ff->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
Dmitry Torokhov
maintainerQuoted 25 lines · Dan Carpenter
Quoted 24 lines · Dmitry Torokhov
Quoted 23 lines · Dan Carpenter
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 <[email protected]>drivers/input/ff-core.c +1
-1@@ -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 ;
Quoted 8 lines
Quoted 6 lines
drivers/input/ff-core.c int input_ff_event(struct input_dev *dev, unsigned int type, · line 283
Quoted 3 lines
drivers/input/ff-core.c +1
-1case 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.
Signature · 1 line
Dmitry
Quoted 1 line · Dmitry Torokhov
That's fine, I'll adjust on my side.
Thanks!
regards,
dan carpenter