lkml.org 
[lkml]   [2014]   [Dec]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4/4] iio: dht11: Fix out-of-bounds read
Richard Weinberger schrieb am 03.12.2014 um 00:32:
> As we access i-1 we must not start with i=0.
>
> Signed-off-by: Richard Weinberger <richard@nod.at>
Acked-by: Hartmut Knaack <knaack.h@gmx.de>
> ---
> drivers/iio/humidity/dht11.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/humidity/dht11.c b/drivers/iio/humidity/dht11.c
> index fbcd7cb..5dfe71b 100644
> --- a/drivers/iio/humidity/dht11.c
> +++ b/drivers/iio/humidity/dht11.c
> @@ -90,7 +90,7 @@ static int dht11_decode(struct dht11 *dht11, int offset)
> unsigned char temp_int, temp_dec, hum_int, hum_dec, checksum;
>
> /* Calculate timestamp resolution */
> - for (i = 0; i < dht11->num_edges; ++i) {
> + for (i = 1; i < dht11->num_edges; ++i) {
> t = dht11->edges[i].ts - dht11->edges[i-1].ts;
> if (t > 0 && t < timeres)
> timeres = t;
>



\
 
 \ /
  Last update: 2014-12-14 13:41    [W:0.398 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site