Skip to contentSkip to conversation

cpupower update for Linux 6.18-rc1

GIT PULL Shuah Khan 2 participants 2 messages Sep 28, 2025 – Sep 29, 2025 CPU power monitoring

lore
Share & tools
lore

Shuah Khan

author maintainer
#0 lore raw

Hi Rafael,

Please pull the following cpupower update for Linux 6.18-rc1.

Fixes incorrect return vale in cpupower_write_sysfs() error path and passing incorrect size to cpuidle_state_write_file() while writing status to disable file in cpuidle_state_disable().

diff is attached.

thanks,
-- Shuah

----------------------------------------------------------------
The following changes since commit f83ec76bf285bea5727f478a68b894f5543ca76e:

Linux 6.17-rc6 (2025-09-14 14:21:14 -0700)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux tags/linux-cpupower-6.18-rc1

for you to fetch changes up to 23199d2aa6dcaf6dd2da772f93d2c94317d71459:

tools/cpupower: Fix incorrect size in cpuidle_state_disable() (2025-09-24 17:15:35 -0600)

----------------------------------------------------------------
linux-cpupower-6.18-rc1

Fixes incorrect return vale in cpupower_write_sysfs() error path and passing incorrect size to cpuidle_state_write_file() while writing status to disable file in cpuidle_state_disable().

----------------------------------------------------------------
Kaushlendra Kumar (2):
tools/cpupower: fix error return value in cpupower_write_sysfs() tools/cpupower: Fix incorrect size in cpuidle_state_disable()

 tools/power/cpupower/lib/cpuidle.c  | 5 +++--
 tools/power/cpupower/lib/cpupower.c | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

----------------------------------------------------------------

tools/power/cpupower/lib/cpuidle.c +3 -2
index 0ecac009273c..f2c1139adf71 100644
@@ -233,6 +233,7 @@ int cpuidle_state_disable(unsigned int cpu,
 {
 	char value[SYSFS_PATH_MAX];
 	int bytes_written;
+	int len;
 
 	if (cpuidle_state_count(cpu) <= idlestate)
 		return -1;
@@ -241,10 +242,10 @@ int cpuidle_state_disable(unsigned int cpu,
 				 idlestate_value_files[IDLESTATE_DISABLE]))
 		return -2;
 
-	snprintf(value, SYSFS_PATH_MAX, "%u", disable);
+	len = snprintf(value, SYSFS_PATH_MAX, "%u", disable);
 
 	bytes_written = cpuidle_state_write_file(cpu, idlestate, "disable",
-						   value, sizeof(disable));
+						   value, len);
 	if (bytes_written)
 		return 0;
 	return -3;
tools/power/cpupower/lib/cpupower.c +1 -1
index ce8dfb8e46ab..d7f7ec6f151c 100644
@@ -56,7 +56,7 @@ unsigned int cpupower_write_sysfs(const char *path, char *buf, size_t buflen)
 	if (numwritten < 1) {
 		perror(path);
 		close(fd);
-		return -1;
+		return 0;
 	}
 
 	close(fd);
#1 lore raw

Hi Shuah,

Quoted 39 lines · Shuah Khan

Hi Rafael,

Please pull the following cpupower update for Linux 6.18-rc1.

Fixes incorrect return vale in cpupower_write_sysfs() error path and passing incorrect size to cpuidle_state_write_file() while writing status to disable file in cpuidle_state_disable().

diff is attached.

thanks,
-- Shuah

----------------------------------------------------------------
The following changes since commit f83ec76bf285bea5727f478a68b894f5543ca76e:

   Linux 6.17-rc6 (2025-09-14 14:21:14 -0700)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux tags/linux-cpupower-6.18-rc1

for you to fetch changes up to 23199d2aa6dcaf6dd2da772f93d2c94317d71459:

   tools/cpupower: Fix incorrect size in cpuidle_state_disable() (2025-09-24 17:15:35 -0600)

----------------------------------------------------------------
linux-cpupower-6.18-rc1

Fixes incorrect return vale in cpupower_write_sysfs() error path and passing incorrect size to cpuidle_state_write_file() while writing status to disable file in cpuidle_state_disable().

----------------------------------------------------------------
Kaushlendra Kumar (2):
tools/cpupower: fix error return value in cpupower_write_sysfs() tools/cpupower: Fix incorrect size in cpuidle_state_disable()

Quoted 4 lines
  tools/power/cpupower/lib/cpuidle.c  | 5 +++--
  tools/power/cpupower/lib/cpupower.c | 2 +-
  2 files changed, 4 insertions(+), 3 deletions(-)

----------------------------------------------------------------

Pulled and added to linux-pm.git/linux-next, thanks!