Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1390895 > unrolled thread

[patch] iio: dac: ad5592r: Off by one bug in ad5592r_alloc_channels()

Started byDan Carpenter <dan.carpenter@oracle.com>
First post2016-04-29 11:10 +0200
Last post2016-05-04 16:50 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [patch] iio: dac: ad5592r: Off by one bug in ad5592r_alloc_channels() Dan Carpenter <dan.carpenter@oracle.com> - 2016-04-29 11:10 +0200
    Re: [patch] iio: dac: ad5592r: Off by one bug in  ad5592r_alloc_channels() Jonathan Cameron <jic23@kernel.org> - 2016-05-01 23:30 +0200
      Re: [patch] iio: dac: ad5592r: Off by one bug in  ad5592r_alloc_channels() Jonathan Cameron <jic23@kernel.org> - 2016-05-04 16:50 +0200

#1390895 — [patch] iio: dac: ad5592r: Off by one bug in ad5592r_alloc_channels()

FromDan Carpenter <dan.carpenter@oracle.com>
Date2016-04-29 11:10 +0200
Subject[patch] iio: dac: ad5592r: Off by one bug in ad5592r_alloc_channels()
Message-ID<rtcAV-3l0-13@gated-at.bofh.it>
The > here should be >= or we go beyond the end for the array.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

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);

[toc] | [next] | [standalone]


#1391897 — Re: [patch] iio: dac: ad5592r: Off by one bug in ad5592r_alloc_channels()

FromJonathan Cameron <jic23@kernel.org>
Date2016-05-01 23:30 +0200
SubjectRe: [patch] iio: dac: ad5592r: Off by one bug in ad5592r_alloc_channels()
Message-ID<ru76b-86o-29@gated-at.bofh.it>
In reply to#1390895
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
> 

[toc] | [prev] | [next] | [standalone]


#1394385 — Re: [patch] iio: dac: ad5592r: Off by one bug in ad5592r_alloc_channels()

FromJonathan Cameron <jic23@kernel.org>
Date2016-05-04 16:50 +0200
SubjectRe: [patch] iio: dac: ad5592r: Off by one bug in ad5592r_alloc_channels()
Message-ID<rv6hI-5S0-11@gated-at.bofh.it>
In reply to#1391897
On 01/05/16 20:04, Jonathan Cameron wrote:
> 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!)
Applied to the fixes-togreg-post-rc1 branch of iio.git which I'll
push out sometime in the next few days.

Jonathan
>>
>> 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
>>
> 
> --
> 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
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web