Skip to content

Commit 5cf952c

Browse files
spandruvadarafaeljw
authored andcommitted
thermal: intel: int340x: Power Slider: Validate slider_balance range
When the module parameter slider_balance is set to the performance slider value of 0, the SoC slider profile switches to the performance mode. This can cause the Linux power-profiles-daemon to change the system power mode to performance from balanced mode. This happens when there is only one platform profile registered as there will be no conflict with other platform profiles. Same issue occurs when the slider_balance is set to the power-saver slider value. Prevent module parameter slider_balance from overlapping with performance and power-saver slider values by adding range validation. Return an error when an invalid value is provided. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Link: https://patch.msgid.link/20250923205631.3056590-1-srinivas.pandruvada@linux.intel.com [ rjw: Changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 0115d06 commit 5cf952c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/thermal/intel/int340x_thermal/processor_thermal_soc_slider.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ static int slider_def_balance_set(const char *arg, const struct kernel_param *kp
6767

6868
ret = kstrtou8(arg, 16, &slider_val);
6969
if (!ret) {
70-
if (slider_val > SOC_SLIDER_VALUE_MAXIMUM)
70+
if (slider_val <= slider_values[SOC_POWER_SLIDER_PERFORMANCE] ||
71+
slider_val >= slider_values[SOC_POWER_SLIDER_POWERSAVE])
7172
return -EINVAL;
7273

7374
slider_balanced_param = slider_val;

0 commit comments

Comments
 (0)