lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aO9jDMvkxsSzl3xf@BLRRASHENOY1.amd.com>
Date: Wed, 15 Oct 2025 14:32:04 +0530
From: "Gautham R. Shenoy" <gautham.shenoy@....com>
To: "Mario Limonciello (AMD)" <superm1@...nel.org>
Cc: Perry Yuan <perry.yuan@....com>,
	"open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <linux-kernel@...r.kernel.org>,
	"open list:CPU FREQUENCY SCALING FRAMEWORK" <linux-pm@...r.kernel.org>
Subject: Re: [PATCH v2 4/6] cpufreq/amd-pstate: Adjust return values in
 amd_pstate_update_status()

Hello Mario,

On Thu, Oct 09, 2025 at 11:17:54AM -0500, Mario Limonciello (AMD) wrote:
> get_mode_idx_from_str() already checks the upper boundary for a string
> sent.  Drop the extra check in amd_pstate_update_status() and pass
> the return code if there is a failure.

Looks good to me. This patch doesn't introduce any behavioural change
since in the absence of a match, get_mode_idx_from_str() returns
-EINVAL, which is what was being returned by
amd_pstate_update_status() previously when @buf contains an invalid
string.

Reviewed-by: Gautham R. Shenoy <gautham.shenoy@....com>

> 
> Signed-off-by: Mario Limonciello (AMD) <superm1@...nel.org>
> ---
>  drivers/cpufreq/amd-pstate.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index 5feb9f5e3a491..2d2ef53d12447 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -1346,9 +1346,8 @@ int amd_pstate_update_status(const char *buf, size_t size)
>  		return -EINVAL;
>  
>  	mode_idx = get_mode_idx_from_str(buf, size);
> -
> -	if (mode_idx < 0 || mode_idx >= AMD_PSTATE_MAX)
> -		return -EINVAL;
> +	if (mode_idx < 0)
> +		return mode_idx;
>  
>  	if (mode_state_machine[cppc_state][mode_idx]) {
>  		guard(mutex)(&amd_pstate_driver_lock);
> -- 
> 2.43.0
> 

-- 
Thanks and Regards
gautham.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ