diff options
author | Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com> | 2025-02-26 01:30:01 +0300 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.com> | 2025-03-04 23:42:44 +0300 |
commit | 0c6673e3d17b258b8c5c7331d28bf6c49f25ed30 (patch) | |
tree | d29ba3a5efb91665d7da55059f60a3286bbb706a | |
parent | bbeface1051142bcb0473fdcc89102ea5b31607d (diff) | |
download | linux-0c6673e3d17b258b8c5c7331d28bf6c49f25ed30.tar.xz |
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>
-rw-r--r-- | drivers/hid/usbhid/hid-pidff.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/hid/usbhid/hid-pidff.c b/drivers/hid/usbhid/hid-pidff.c index ffecc712be00..74b033a4ac1b 100644 --- a/drivers/hid/usbhid/hid-pidff.c +++ b/drivers/hid/usbhid/hid-pidff.c @@ -690,7 +690,8 @@ static void pidff_playback_pid(struct pidff_device *pidff, int pid_id, int n) } else { pidff->effect_operation_status->value[0] = pidff->operation_id[PID_EFFECT_START]; - pidff->effect_operation[PID_LOOP_COUNT].value[0] = n; + pidff->effect_operation[PID_LOOP_COUNT].value[0] = + pidff_clamp(n, pidff->effect_operation[PID_LOOP_COUNT].field); } hid_hw_request(pidff->hid, pidff->reports[PID_EFFECT_OPERATION], |