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]
Date: Tue, 23 Apr 2024 09:11:07 +0200 (CEST)
From: Julia Lawall <julia.lawall@...ia.fr>
To: Shivani Gupta <shivani07g@...il.com>
cc: "Rafael J . Wysocki" <rafael@...nel.org>, 
    Viresh Kumar <viresh.kumar@...aro.org>, linux-pm@...r.kernel.org, 
    linux-kernel@...r.kernel.org, skhan@...uxfoundation.org, 
    javier.carrasco.cruz@...il.com
Subject: Re: [PATCH] cpufreq: ti: Implement scope-based cleanup in
 ti_cpufreq_match_node()



On Tue, 23 Apr 2024, Shivani Gupta wrote:

> This patch modifies the ti_cpufreq_match_node() function to utilize the
> __free() cleanup handler for automatically releasing the device
> node when it goes out of scope.
>
> By moving the declaration to the initialization, the patch ensures that
> the device node is properly managed throughout the function's scope,
> thus eliminating the need for manual invocation of of_node_put().
> This approach reduces the potential for memory leaks.

The code is fine.  The log message is a bit verbose.  Try to avoid
referring to the patch.  It's obvious that you are talking about the
patch.  Try to favor the imperative, so "Modify..." instead of "This patch
modifies".

julia


>
> Suggested-by: Julia Lawall <julia.lawall@...ia.fr>
> Signed-off-by: Shivani Gupta <shivani07g@...il.com>
> ---
>  drivers/cpufreq/ti-cpufreq.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/cpufreq/ti-cpufreq.c b/drivers/cpufreq/ti-cpufreq.c
> index 46c41e2ca727..714ed53753fa 100644
> --- a/drivers/cpufreq/ti-cpufreq.c
> +++ b/drivers/cpufreq/ti-cpufreq.c
> @@ -347,12 +347,10 @@ static const struct of_device_id ti_cpufreq_of_match[] = {
>
>  static const struct of_device_id *ti_cpufreq_match_node(void)
>  {
> -	struct device_node *np;
> +	struct device_node *np __free(device_node) = of_find_node_by_path("/");
>  	const struct of_device_id *match;
>
> -	np = of_find_node_by_path("/");
>  	match = of_match_node(ti_cpufreq_of_match, np);
> -	of_node_put(np);
>
>  	return match;
>  }
> --
> 2.34.1
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ