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] [day] [month] [year] [list]
Message-ID: <703531ba0d3183ffc77e5a76922099564848091e.camel@perches.com>
Date: Wed, 22 Oct 2025 06:37:15 -0700
From: Joe Perches <joe@...ches.com>
To: Viresh Kumar <viresh.kumar@...aro.org>, "Rafael J. Wysocki"	
 <rafael@...nel.org>, Viresh Kumar <vireshk@...nel.org>, Nishanth Menon
 <nm@...com>,  Stephen Boyd <sboyd@...nel.org>
Cc: linux-pm@...r.kernel.org, Vincent Guittot <vincent.guittot@...aro.org>, 
 Dan Carpenter <dan.carpenter@...aro.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] OPP: Initialize scope-based pointers inline

On Wed, 2025-10-22 at 15:49 +0530, Viresh Kumar wrote:
> Uninitialized pointers with `__free` attribute can cause undefined
> behaviour as the memory allocated to the pointer is freed automatically
> when the pointer goes out of scope.
[]
> diff --git a/drivers/opp/core.c b/drivers/opp/core.c
[]
> @@ -309,9 +309,8 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_is_turbo);
>   */
>  unsigned long dev_pm_opp_get_max_clock_latency(struct device *dev)
>  {
> -	struct opp_table *opp_table __free(put_opp_table);
> -
> -	opp_table = _find_opp_table(dev);
> +	struct opp_table *opp_table __free(put_opp_table) =
> +		_find_opp_table(dev);

Style trivia:

It's common to include a blank line after the definitions.

> @@ -327,7 +326,6 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_max_clock_latency);
>   */
>  unsigned long dev_pm_opp_get_max_volt_latency(struct device *dev)
>  {
> -	struct opp_table *opp_table __free(put_opp_table);
>  	struct dev_pm_opp *opp;
>  	struct regulator *reg;
>  	unsigned long latency_ns = 0;
> @@ -337,7 +335,8 @@ unsigned long dev_pm_opp_get_max_volt_latency(struct device *dev)
>  		unsigned long max;
>  	} *uV;
>  
> -	opp_table = _find_opp_table(dev);
> +	struct opp_table *opp_table __free(put_opp_table) =
> +		_find_opp_table(dev);

here too etc...

>  	if (IS_ERR(opp_table))
>  		return 0;
>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ