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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dfd59e3f-b60b-da09-bf23-a05de5f4575a@ti.com>
Date:   Tue, 23 Apr 2019 10:31:41 -0500
From:   Dan Murphy <dmurphy@...com>
To:     Brian Masney <masneyb@...tation.org>
CC:     <lee.jones@...aro.org>, <daniel.thompson@...aro.org>,
        <jingoohan1@...il.com>, <robh+dt@...nel.org>,
        <jacek.anaszewski@...il.com>, <pavel@....cz>,
        <mark.rutland@....com>, <b.zolnierkie@...sung.com>,
        <dri-devel@...ts.freedesktop.org>, <linux-leds@...r.kernel.org>,
        <devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <linux-fbdev@...r.kernel.org>, <jonathan@...ek.ca>
Subject: Re: [PATCH v5 3/3] backlight: lm3630a: add firmware node support

Brian

On 4/23/19 9:01 AM, Brian Masney wrote:
> On Tue, Apr 23, 2019 at 08:49:20AM -0500, Dan Murphy wrote:
>>> +static int lm3630a_parse_led_sources(struct fwnode_handle *node,
>>> +				     int default_led_sources)
>>> +{
>>> +	u32 sources[LM3630A_NUM_SINKS];
>>> +	int ret, num_sources, i;
>>> +
>>> +	num_sources = fwnode_property_read_u32_array(node, "led-sources", NULL,
>>> +						     0);
>>> +	if (num_sources < 0)
>>> +		return default_led_sources;
>>> +	else if (num_sources > ARRAY_SIZE(sources))
>>> +		return -EINVAL;
>>> +
>>> +	ret = fwnode_property_read_u32_array(node, "led-sources", sources,
>>> +					     num_sources);
>>> +	if (ret)
>>> +		return ret;
>>> +
>>> +	for (i = 0; i < num_sources; i++) {
>>> +		if (sources[i] < LM3630A_SINK_0 || sources[i] > LM3630A_SINK_1)
>>> +			return -EINVAL;
>>> +
>>> +		ret |= BIT(sources[i]);
>>> +	}
>>> +
>>> +	return ret;
>>> +}
>>> +
>>> +static int lm3630a_parse_bank(struct lm3630a_platform_data *pdata,
>>> +			      struct fwnode_handle *node, int *seen_led_sources)
>>
>> Why is seen_led_sources passed in here?
>> It is initialized on the stack in lm3630a_parse_node but the variable is never referenced in that API.
> 
> It's to see all of the led-sources that are configured across all of the
> banks. If it is just in lm3630a_parse_bank(), then it won't catch the
> following invalid configuration:
> 

Ok I see what it is for now.

Not sure why it is declared as a pointer though.

Dan

> led@0 {
> 	reg = <0>;
> 	led-sources = <0 1>;
> 	label = "lcd-backlight";
> 	default-brightness = <200>;
> };
> 
> led@1 {
> 	reg = <1>;
> 	default-brightness = <150>;
> };
> 
> Brian
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ