Commit 23199d2a authored by Kaushlendra Kumar's avatar Kaushlendra Kumar Committed by Shuah Khan
Browse files

tools/cpupower: Fix incorrect size in cpuidle_state_disable()

Fix incorrect size parameter passed to cpuidle_state_write_file() in
cpuidle_state_disable().

The function was incorrectly using sizeof(disable) which returns the
size of the unsigned int variable (4 bytes) instead of the actual
length of the string stored in the 'value' buffer.

Since 'value' is populated with snprintf() to contain the string
representation of the disable value, we should use the length
returned by snprintf() to get the correct string length for
writing to the sysfs file.

This ensures the correct number of bytes is written to the cpuidle
state disable file in sysfs.

Link: https://lore.kernel.org/r/20250917050820.1785377-1-kaushlendra.kumar@intel.com


Signed-off-by: default avatarKaushlendra Kumar <kaushlendra.kumar@intel.com>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent 57b100d4
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment