lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 18 Jan 2012 18:06:46 +0100
From:	walter harms <wharms@....de>
To:	Dan Carpenter <dan.carpenter@...cle.com>
CC:	Mauro Carvalho Chehab <mchehab@...radead.org>,
	"Igor M. Liplianin" <liplianin@...by>, linux-media@...r.kernel.org,
	linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [patch 2/2] [media] ds3000: off by one in ds3000_read_snr()



Am 17.01.2012 08:30, schrieb Dan Carpenter:
> This is a static checker patch and I don't have the hardware to test
> this, so please review it carefully.  The dvbs2_snr_tab[] array has 80
> elements so when we cap it at 80, that's off by one.  I would have
> assumed that the test was wrong but in the lines right before we have
> the same test but use "snr_reading - 1" as the array offset.  I've done
> the same thing here.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
> 
> diff --git a/drivers/media/dvb/frontends/ds3000.c b/drivers/media/dvb/frontends/ds3000.c
> index af65d01..3f5ae0a 100644
> --- a/drivers/media/dvb/frontends/ds3000.c
> +++ b/drivers/media/dvb/frontends/ds3000.c
> @@ -681,7 +681,7 @@ static int ds3000_read_snr(struct dvb_frontend *fe, u16 *snr)
>  			snr_reading = dvbs2_noise_reading / tmp;
>  			if (snr_reading > 80)
>  				snr_reading = 80;
> -			*snr = -(dvbs2_snr_tab[snr_reading] / 1000);
> +			*snr = -(dvbs2_snr_tab[snr_reading - 1] / 1000);
>  		}
>  		dprintk("%s: raw / cooked = 0x%02x / 0x%04x\n", __func__,
>  				snr_reading, *snr);

hi dan,

perhaps it is more useful to do it in the check above ?
thinking about that why not replace the number (80) with ARRAY_SIZE() ?

re,
 wh



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ