]> Devoid-pointer.net GitWeb - KLGD_FF_plugin.git/commitdiff
Fix an overflow in constant force scaling in the testing module
authorMichal Malý <madcatxster@devoid-pointer.net>
Sun, 27 Sep 2015 23:26:06 +0000 (01:26 +0200)
committerMichal Malý <madcatxster@devoid-pointer.net>
Sun, 27 Sep 2015 23:26:06 +0000 (01:26 +0200)
testmod/klgdff.c

index 8b57b7576cca54bec24bef06431ea55cfc43a050..c80995b998c1c0bb6897bc7f6f26b149c9708e51 100644 (file)
@@ -145,7 +145,7 @@ static int klgdff_start(struct klgd_command_stream *s, const struct ff_effect *e
        {
                s32 x;
                s32 y;
-               s16 level = effect->u.constant.level * gain / 0xFFFF;
+               s32 level = effect->u.constant.level * gain / 0xFFFF;
 
                ffpl_lvl_dir_to_x_y(level, effect->direction, &x, &y);
                text = kasprintf(GFP_KERNEL, "Playing FF_CONSTANT, level: %d, dir: %u, X: %d, Y: %d", level, effect->direction, x, y);
@@ -196,7 +196,7 @@ static int klgdff_update(struct klgd_command_stream *s, const struct ff_effect *
        {
                s32 x;
                s32 y;
-               s16 level = effect->u.constant.level * gain / 0xFFFF;
+               s32 level = effect->u.constant.level * gain / 0xFFFF;
 
                ffpl_lvl_dir_to_x_y(level, effect->direction, &x, &y);
                text = kasprintf(GFP_KERNEL, "Updating FF_CONSTANT, level: %d, dir: %u, X: %d, Y: %d", level, effect->direction, x, y);
@@ -247,7 +247,7 @@ static int klgdff_up_start(struct klgd_command_stream *s, const struct ff_effect
        {
                s32 x;
                s32 y;
-               s16 level = effect->u.constant.level * gain / 0xFFFF;
+               s32 level = effect->u.constant.level * gain / 0xFFFF;
 
                ffpl_lvl_dir_to_x_y(level, effect->direction, &x, &y);
                text = kasprintf(GFP_KERNEL, "Uploading and starting FF_CONSTANT, level: %d, dir: %u, X: %d, Y: %d", level, effect->direction, x, y);