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:	Thu, 17 Sep 2015 11:13:28 -0700
From:	Stephen Boyd <sboyd@...eaurora.org>
To:	Viresh Kumar <viresh.kumar@...aro.org>
Cc:	Rafael Wysocki <rjw@...ysocki.net>, linaro-kernel@...ts.linaro.org,
	linux-pm@...r.kernel.org, nm@...com,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Len Brown <len.brown@...el.com>,
	open list <linux-kernel@...r.kernel.org>,
	Pavel Machek <pavel@....cz>
Subject: Re: [PATCH] PM / OPP: of_property_count_u32_elems() can return errors

On 09/17, Viresh Kumar wrote:
> +++ b/drivers/base/power/opp.c
> @@ -889,13 +889,22 @@ static int _opp_add_dynamic(struct device *dev, unsigned long freq,
>  /* TODO: Support multiple regulators */
>  static int opp_get_microvolt(struct dev_pm_opp *opp, struct device *dev)
>  {
> +	struct property *prop;
>  	u32 microvolt[3] = {0};
>  	int count, ret;
>  
> -	count = of_property_count_u32_elems(opp->np, "opp-microvolt");
> -	if (!count)
> +	/* Missing property isn't a problem, but an invalid entry is */
> +	prop = of_find_property(opp->np, "opp-microvolt", NULL);

Prop isn't used anywhere so why not remove the local variable and
test the result of this call inside the if condition?

> +	if (!prop)
>  		return 0;
>  
> +	count = of_property_count_u32_elems(opp->np, "opp-microvolt");
> +	if (count < 0) {

We can't test count for -EINVAL to detect the missing property
because -EINVAL is also returned on a non-multiple of u32 length
property? Maybe we shouldn't worry about that case and turn
-EINVAL into 0.

> +		dev_err(dev, "%s: Invalid opp-microvolt property (%d)\n",
> +			__func__, count);
> +		return count;

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ