]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
tools/cpupower: Fix incorrect size in cpuidle_state_disable()
authorKaushlendra Kumar <kaushlendra.kumar@intel.com>
Wed, 17 Sep 2025 05:08:20 +0000 (10:38 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Dec 2025 11:45:08 +0000 (12:45 +0100)
commitcaf2c648edd6e9f3e9e40f6baf9d18488eae69a5
treee9b6ae0ebbe7b6444f5f07f12d9bfe71bf53c918
parente424f1553df698c9cf44f697c94e820cbd6900fa
tools/cpupower: Fix incorrect size in cpuidle_state_disable()

[ Upstream commit 23199d2aa6dcaf6dd2da772f93d2c94317d71459 ]

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: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/power/cpupower/lib/cpuidle.c