lkml.org 
[lkml]   [2016]   [May]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [patch] iio: dac: ad5592r: Off by one bug in ad5592r_alloc_channels()
From
Date
On 29/04/16 10:03, Dan Carpenter wrote:
> The > here should be >= or we go beyond the end for the array.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Good spot - marked it to pick up when I am back on the internet soonish....
(though perhaps not when I my computer manages to sneak this lot out!)
>
> diff --git a/drivers/iio/dac/ad5592r-base.c b/drivers/iio/dac/ad5592r-base.c
> index 948f600..69bde59 100644
> --- a/drivers/iio/dac/ad5592r-base.c
> +++ b/drivers/iio/dac/ad5592r-base.c
> @@ -525,7 +525,7 @@ static int ad5592r_alloc_channels(struct ad5592r_state *st)
>
> device_for_each_child_node(st->dev, child) {
> ret = fwnode_property_read_u32(child, "reg", &reg);
> - if (ret || reg > ARRAY_SIZE(st->channel_modes))
> + if (ret || reg >= ARRAY_SIZE(st->channel_modes))
> continue;
>
> ret = fwnode_property_read_u32(child, "adi,mode", &tmp);
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>

\
 
 \ /
  Last update: 2016-05-01 23:41    [W:0.043 / U:0.332 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site