Skip to content

Commit 0c6673e

Browse files
LawstorantJiri Kosina
authored andcommitted
HID: pidff: Clamp effect playback LOOP_COUNT value
Ensures the loop count will never exceed the logical_maximum. Fixes implementation errors happening when applications use the max value of int32/DWORD as the effect iterations. This could be observed when running software both native and in wine. Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
1 parent bbeface commit 0c6673e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/hid/usbhid/hid-pidff.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,8 @@ static void pidff_playback_pid(struct pidff_device *pidff, int pid_id, int n)
690690
} else {
691691
pidff->effect_operation_status->value[0] =
692692
pidff->operation_id[PID_EFFECT_START];
693-
pidff->effect_operation[PID_LOOP_COUNT].value[0] = n;
693+
pidff->effect_operation[PID_LOOP_COUNT].value[0] =
694+
pidff_clamp(n, pidff->effect_operation[PID_LOOP_COUNT].field);
694695
}
695696

696697
hid_hw_request(pidff->hid, pidff->reports[PID_EFFECT_OPERATION],

0 commit comments

Comments
 (0)