git://ftp.safe.ca
/
safe
/
jmp
/
linux-2.6
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Input: ff-memless - another fix for signed to unsigned overflow
[safe/jmp/linux-2.6]
/
drivers
/
input
/
ff-memless.c
diff --git
a/drivers/input/ff-memless.c
b/drivers/input/ff-memless.c
index
decc51f
..
9667a5f
100644
(file)
--- a/
drivers/input/ff-memless.c
+++ b/
drivers/input/ff-memless.c
@@
-225,7
+225,7
@@
static int get_compatible_type(struct ff_device *ff, int effect_type)
*/
static void ml_combine_effects(struct ff_effect *effect,
struct ml_effect_state *state,
*/
static void ml_combine_effects(struct ff_effect *effect,
struct ml_effect_state *state,
-
unsigned
int gain)
+ int gain)
{
struct ff_effect *new = state->effect;
unsigned int strong, weak, i;
{
struct ff_effect *new = state->effect;
unsigned int strong, weak, i;
@@
-252,8
+252,8
@@
static void ml_combine_effects(struct ff_effect *effect,
break;
case FF_RUMBLE:
break;
case FF_RUMBLE:
- strong = new->u.rumble.strong_magnitude * gain / 0xffff;
- weak = new->u.rumble.weak_magnitude * gain / 0xffff;
+ strong =
(u32)
new->u.rumble.strong_magnitude * gain / 0xffff;
+ weak =
(u32)
new->u.rumble.weak_magnitude * gain / 0xffff;
effect->u.rumble.strong_magnitude =
min(strong + effect->u.rumble.strong_magnitude,
0xffffU);
effect->u.rumble.strong_magnitude =
min(strong + effect->u.rumble.strong_magnitude,
0xffffU);