Re: [RFC PATCH 3/5] drivers: base: Introducing software nodes to the firmware node framework

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 16, 2018 at 03:57:43PM +0300, Andy Shevchenko wrote:
> > +static int property_entry_read_string_array(const struct property_entry *props,
> > +					    const char *propname,
> > +					    const char **strings, size_t nval)
> > +{
> > +	const struct property_entry *prop;
> > +	const void *pointer;
> > +	size_t array_len, length;
> > +
> > +	/* Find out the array length. */
> > +	prop = property_entry_get(props, propname);
> > +	if (!prop)
> > +		return -EINVAL;
> > +
> 
> > +	if (!prop->is_array)
> > +		/* The array length for a non-array string property is 1. */
> > +		array_len = 1;
> > +	else
> > +		/* Find the length of an array. */
> > +		array_len = property_entry_count_elems_of_size(props, propname,
> > +							  sizeof(const char *));
> 
> I understand where it comes from, but here we may use positive condition.

OK.

> > +#define NODE_NAME_MAXSIZE	11
> 
> sizeof(int) = 4 (32 bits), so, 32 * 3 / 10 ~= 10. On top are "node" and '\0'.
> Thus, I would rather put 16 here. Or limit the maximum for ida_simple_get().

Let's make it 16.


thanks,

-- 
heikki



[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux