Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PM: intel_powerclamp: off by one in start_power_clamp()

This value has already been clamped correctly to 0 through 49 in
powerclamp_set_cur_state() so this patch doesn't actually change
anything. But we should fix it anyway for consistency.

set_target_ratio is used as an offset into an array with
MAX_TARGET_RATIO (50) elements.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>

authored by

Dan Carpenter and committed by
Zhang Rui
c8165dc0 3ad9524a

+1 -1
+1 -1
drivers/thermal/intel_powerclamp.c
··· 504 504 return -EINVAL; 505 505 } 506 506 507 - set_target_ratio = clamp(set_target_ratio, 0U, MAX_TARGET_RATIO); 507 + set_target_ratio = clamp(set_target_ratio, 0U, MAX_TARGET_RATIO - 1); 508 508 /* prevent cpu hotplug */ 509 509 get_online_cpus(); 510 510