]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
tools/cpupower: Use strcspn() to strip trailing newline
authorKaushlendra Kumar <kaushlendra.kumar@intel.com>
Thu, 27 Nov 2025 04:45:36 +0000 (10:15 +0530)
committerShuah Khan <skhan@linuxfoundation.org>
Mon, 15 Dec 2025 19:33:28 +0000 (12:33 -0700)
commit1b9aaf36b7b40235e5a529c15848c3d866362207
treeb1e4f17591accf422b3274421dc753c79e6d8ce9
parent24858a84163c8d04827166b3bcaed80612bb62fc
tools/cpupower: Use strcspn() to strip trailing newline

Replace manual newline removal with strcspn() which is safer and
cleaner. This avoids potential out-of-bounds access on empty strings
and handles the case where no newline exists.

Link: https://lore.kernel.org/r/20251127044536.715722-1-kaushlendra.kumar@intel.com
Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/power/cpupower/lib/cpuidle.c