Re: [PATCHv3 1/6] of: Add support for reading a u32 from a multi-valueproperty.

From: Stephen Warren
Date: Mon Apr 01 2013 - 12:49:49 EST


On 03/28/2013 12:10 AM, Tony Prisk wrote:
> This patch adds an of_property_read_u32_index() function to allow
> reading a single indexed u32 value from a property containing multiple
> u32 values.

> diff --git a/drivers/of/base.c b/drivers/of/base.c

> +int of_property_read_u32_index(const struct device_node *np,

> + if ((index * sizeof(*out_value)) > prop->length)
> + return -EOVERFLOW;

I think that if should be:

if (((index + 1) * sizeof(*out_value)) > prop->length)

since the code should check if the last byte of the u32 is out-of-range,
not whether the first byte is.

Aside from that, this patch,
Reviewed-by: Stephen Warren <swarren@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/