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:   Fri, 8 Jul 2022 04:04:02 +0900
From:   Chanwoo Choi <cwchoi00@...il.com>
To:     Viresh Kumar <viresh.kumar@...aro.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Chanwoo Choi <cw00.choi@...sung.com>,
        MyungJoo Ham <myungjoo.ham@...sung.com>,
        Kyungmin Park <kyungmin.park@...sung.com>,
        Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
        Alim Akhtar <alim.akhtar@...sung.com>,
        Qiang Yu <yuq825@...il.com>, Rob Herring <robh@...nel.org>,
        Tomeu Vizoso <tomeu.vizoso@...labora.com>,
        Steven Price <steven.price@....com>,
        Alyssa Rosenzweig <alyssa.rosenzweig@...labora.com>,
        Nishanth Menon <nm@...com>, Stephen Boyd <sboyd@...nel.org>,
        Thierry Reding <thierry.reding@...il.com>,
        Jonathan Hunter <jonathanh@...dia.com>
Cc:     linux-pm@...r.kernel.org,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-kernel@...r.kernel.org, linux-samsung-soc@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org,
        dri-devel@...ts.freedesktop.org, lima@...ts.freedesktop.org,
        linux-tegra@...r.kernel.org
Subject: Re: [PATCH V3 02/20] OPP: Make dev_pm_opp_set_regulators() accept
 NULL terminated list

On 22. 7. 4. 21:07, Viresh Kumar wrote:
> Make dev_pm_opp_set_regulators() accept a NULL terminated list of names
> instead of making the callers keep the two parameters in sync, which
> creates an opportunity for bugs to get in.
> 
> Suggested-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> Signed-off-by: Viresh Kumar <viresh.kumar@...aro.org>
> ---
>  drivers/cpufreq/cpufreq-dt.c                |  9 ++++-----
>  drivers/cpufreq/ti-cpufreq.c                |  7 +++----
>  drivers/devfreq/exynos-bus.c                |  4 ++--
>  drivers/gpu/drm/lima/lima_devfreq.c         |  3 ++-
>  drivers/gpu/drm/panfrost/panfrost_devfreq.c |  4 ++--
>  drivers/opp/core.c                          | 18 ++++++++++++------
>  drivers/soc/tegra/pmc.c                     |  4 ++--
>  include/linux/pm_opp.h                      |  9 ++++-----
>  8 files changed, 31 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
> index 8fcaba541539..be0c19b3ffa5 100644
> --- a/drivers/cpufreq/cpufreq-dt.c
> +++ b/drivers/cpufreq/cpufreq-dt.c
> @@ -193,7 +193,7 @@ static int dt_cpufreq_early_init(struct device *dev, int cpu)
>  	struct private_data *priv;
>  	struct device *cpu_dev;
>  	bool fallback = false;
> -	const char *reg_name;
> +	const char *reg_name[] = { NULL, NULL };
>  	int ret;
>  
>  	/* Check if this CPU is already covered by some other policy */
> @@ -218,10 +218,9 @@ static int dt_cpufreq_early_init(struct device *dev, int cpu)
>  	 * OPP layer will be taking care of regulators now, but it needs to know
>  	 * the name of the regulator first.
>  	 */
> -	reg_name = find_supply_name(cpu_dev);
> -	if (reg_name) {
> -		priv->opp_table = dev_pm_opp_set_regulators(cpu_dev, &reg_name,
> -							    1);
> +	reg_name[0] = find_supply_name(cpu_dev);
> +	if (reg_name[0]) {
> +		priv->opp_table = dev_pm_opp_set_regulators(cpu_dev, reg_name);
>  		if (IS_ERR(priv->opp_table)) {
>  			ret = PTR_ERR(priv->opp_table);
>  			if (ret != -EPROBE_DEFER)
> diff --git a/drivers/cpufreq/ti-cpufreq.c b/drivers/cpufreq/ti-cpufreq.c
> index 8f9fdd864391..560d67a6bef1 100644
> --- a/drivers/cpufreq/ti-cpufreq.c
> +++ b/drivers/cpufreq/ti-cpufreq.c
> @@ -173,7 +173,7 @@ static struct ti_cpufreq_soc_data omap34xx_soc_data = {
>   *    seems to always read as 0).
>   */
>  
> -static const char * const omap3_reg_names[] = {"cpu0", "vbb"};
> +static const char * const omap3_reg_names[] = {"cpu0", "vbb", NULL};
>  
>  static struct ti_cpufreq_soc_data omap36xx_soc_data = {
>  	.reg_names = omap3_reg_names,
> @@ -326,7 +326,7 @@ static int ti_cpufreq_probe(struct platform_device *pdev)
>  	const struct of_device_id *match;
>  	struct opp_table *ti_opp_table;
>  	struct ti_cpufreq_data *opp_data;
> -	const char * const default_reg_names[] = {"vdd", "vbb"};
> +	const char * const default_reg_names[] = {"vdd", "vbb", NULL};
>  	int ret;
>  
>  	match = dev_get_platdata(&pdev->dev);
> @@ -387,8 +387,7 @@ static int ti_cpufreq_probe(struct platform_device *pdev)
>  		if (opp_data->soc_data->reg_names)
>  			reg_names = opp_data->soc_data->reg_names;
>  		ti_opp_table = dev_pm_opp_set_regulators(opp_data->cpu_dev,
> -							 reg_names,
> -							 ARRAY_SIZE(default_reg_names));
> +							 reg_names);
>  		if (IS_ERR(ti_opp_table)) {
>  			dev_pm_opp_put_supported_hw(opp_data->opp_table);
>  			ret =  PTR_ERR(ti_opp_table);
> diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c
> index e689101abc93..541baff93ee8 100644
> --- a/drivers/devfreq/exynos-bus.c
> +++ b/drivers/devfreq/exynos-bus.c
> @@ -180,10 +180,10 @@ static int exynos_bus_parent_parse_of(struct device_node *np,
>  {
>  	struct device *dev = bus->dev;
>  	struct opp_table *opp_table;
> -	const char *vdd = "vdd";
> +	const char *supplies[] = { "vdd", NULL };
>  	int i, ret, count, size;
>  
> -	opp_table = dev_pm_opp_set_regulators(dev, &vdd, 1);
> +	opp_table = dev_pm_opp_set_regulators(dev, supplies);
>  	if (IS_ERR(opp_table)) {
>  		ret = PTR_ERR(opp_table);
>  		dev_err(dev, "failed to set regulators %d\n", ret);

Reviewed-by: Chanwoo Choi <cw00.choi@...sung.com>

(snip)

-- 
Best Regards,
Samsung Electronics
Chanwoo Choi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ