summaryrefslogtreecommitdiff
path: root/linux/drivers
diff options
context:
space:
mode:
authorJohannes Stezenbach <devnull@localhost>2005-09-26 21:39:09 +0000
committerJohannes Stezenbach <devnull@localhost>2005-09-26 21:39:09 +0000
commitbb36e3dc84fcc19866c2225e1ec3fa64bc8d4acd (patch)
tree3a91bbf7f0eca0df22ee9e6eefdbded1fa98774a /linux/drivers
parent806216f8fda8d16aa2423f8e8c97ff3a3600d1a5 (diff)
downloadmediapointer-dvb-s2-bb36e3dc84fcc19866c2225e1ec3fa64bc8d4acd.tar.gz
mediapointer-dvb-s2-bb36e3dc84fcc19866c2225e1ec3fa64bc8d4acd.tar.bz2
Fix integer overflow bug in read_signal_strength()
reported by Anthony Leclerc. Signed-off-by: Johannes Stezenbach <js@linuxtv.org>
Diffstat (limited to 'linux/drivers')
-rw-r--r--linux/drivers/media/dvb/frontends/or51132.c7
-rw-r--r--linux/drivers/media/dvb/frontends/or51211.c8
2 files changed, 12 insertions, 3 deletions
diff --git a/linux/drivers/media/dvb/frontends/or51132.c b/linux/drivers/media/dvb/frontends/or51132.c
index b6d0eecc5..a0e5091d9 100644
--- a/linux/drivers/media/dvb/frontends/or51132.c
+++ b/linux/drivers/media/dvb/frontends/or51132.c
@@ -466,6 +466,7 @@ static int or51132_read_signal_strength(struct dvb_frontend* fe, u16* strength)
unsigned char snd_buf[2];
u8 rcvr_stat;
u16 snr_equ;
+ u32 signal_strength;
int usK;
snd_buf[0]=0x04;
@@ -501,7 +502,11 @@ static int or51132_read_signal_strength(struct dvb_frontend* fe, u16* strength)
usK = (rcvr_stat & 0x10) ? 3 : 0;
/* The value reported back from the frontend will be FFFF=100% 0000=0% */
- *strength = (((8952 - i20Log10(snr_equ) - usK*100)/3+5)*65535)/1000;
+ signal_strength = (((8952 - i20Log10(snr_equ) - usK*100)/3+5)*65535)/1000;
+ if (signal_strength > 0xffff)
+ *strength = 0xffff;
+ else
+ *strength = signal_strength;
dprintk("read_signal_strength %i\n",*strength);
return 0;
diff --git a/linux/drivers/media/dvb/frontends/or51211.c b/linux/drivers/media/dvb/frontends/or51211.c
index ad56a9958..b3badafb6 100644
--- a/linux/drivers/media/dvb/frontends/or51211.c
+++ b/linux/drivers/media/dvb/frontends/or51211.c
@@ -337,6 +337,7 @@ static int or51211_read_signal_strength(struct dvb_frontend* fe, u16* strength)
u8 rec_buf[2];
u8 snd_buf[4];
u8 snr_equ;
+ u32 signal_strength;
/* SNR after Equalizer */
snd_buf[0] = 0x04;
@@ -356,8 +357,11 @@ static int or51211_read_signal_strength(struct dvb_frontend* fe, u16* strength)
snr_equ = rec_buf[0] & 0xff;
/* The value reported back from the frontend will be FFFF=100% 0000=0% */
- *strength = (((5334 - i20Log10(snr_equ))/3+5)*65535)/1000;
-
+ signal_strength = (((5334 - i20Log10(snr_equ))/3+5)*65535)/1000;
+ if (signal_strength > 0xffff)
+ *strength = 0xffff;
+ else
+ *strength = signal_strength;
dprintk("read_signal_strength %i\n",*strength);
return 0;