* [PATCH] ds3000: fix array out of bounds access
@ 2014-03-14 17:29 Colin King
0 siblings, 0 replies; only message in thread
From: Colin King @ 2014-03-14 17:29 UTC (permalink / raw)
To: Mauro Carvalho Chehab, linux-media, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
cppcheck reports an array out of bounds access:
[drivers/media/dvb-frontends/ds3000.c:619]: (error) Array
'dvbs2_snr_tab[80]' accessed at index 80, which is out of bounds.
the index check is off by one, so fix this to avoid the error.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/media/dvb-frontends/ds3000.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/dvb-frontends/ds3000.c b/drivers/media/dvb-frontends/ds3000.c
index 1e344b0..d2bda93 100644
--- a/drivers/media/dvb-frontends/ds3000.c
+++ b/drivers/media/dvb-frontends/ds3000.c
@@ -614,8 +614,8 @@ static int ds3000_read_snr(struct dvb_frontend *fe, u16 *snr)
*snr = snr_value * 5 * 655;
} else {
snr_reading = dvbs2_noise_reading / tmp;
- if (snr_reading > 80)
- snr_reading = 80;
+ if (snr_reading > 79)
+ snr_reading = 79;
*snr = -(dvbs2_snr_tab[snr_reading] / 1000);
}
dprintk("%s: raw / cooked = 0x%02x / 0x%04x\n", __func__,
--
1.9.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-03-14 17:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-14 17:29 [PATCH] ds3000: fix array out of bounds access Colin King
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).