From 440a42d3fe797175f368b95fafbdb3da0b232cfa Mon Sep 17 00:00:00 2001 From: Oleg Date: Sun, 26 May 2024 02:10:18 +0300 Subject: [PATCH] Clamp PID_LOOP_COUNT --- hid-pidff.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hid-pidff.c b/hid-pidff.c index 6391c03..094f1ba 100644 --- a/hid-pidff.c +++ b/hid-pidff.c @@ -499,6 +499,9 @@ 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]; + + n = clamp(n, pidff->effect_operation[PID_LOOP_COUNT].field->logical_minimum, + pidff->effect_operation[PID_LOOP_COUNT].field->logical_maximum); pidff->effect_operation[PID_LOOP_COUNT].value[0] = n; }