diff options
author | Johannes Stezenbach <js@linuxtv.org> | 2005-11-09 00:35:25 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-09 10:56:03 -0500 |
commit | b90ed914e513a6ad6184f7a46a0df0888dcfc177 (patch) | |
tree | 31c9b27b6140499dc930e47f6dd1d7cbe0893584 /drivers | |
parent | 5c15c0b4fa850543b8ccfcf93686d24456cc384d (diff) |
[PATCH] dvb: Fix integer overflow bug
Fix integer overflow bug in read_signal_strength() reported by Anthony
Leclerc.
Signed-off-by: Johannes Stezenbach <js@linuxtv.org>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/dvb/frontends/or51132.c | 7 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/or51211.c | 8 |
2 files changed, 12 insertions, 3 deletions
diff --git a/drivers/media/dvb/frontends/or51132.c b/drivers/media/dvb/frontends/or51132.c index fc74c40d6477..78bded861d02 100644 --- a/drivers/media/dvb/frontends/or51132.c +++ b/drivers/media/dvb/frontends/or51132.c | |||
@@ -468,6 +468,7 @@ static int or51132_read_signal_strength(struct dvb_frontend* fe, u16* strength) | |||
468 | unsigned char snd_buf[2]; | 468 | unsigned char snd_buf[2]; |
469 | u8 rcvr_stat; | 469 | u8 rcvr_stat; |
470 | u16 snr_equ; | 470 | u16 snr_equ; |
471 | u32 signal_strength; | ||
471 | int usK; | 472 | int usK; |
472 | 473 | ||
473 | snd_buf[0]=0x04; | 474 | snd_buf[0]=0x04; |
@@ -503,7 +504,11 @@ static int or51132_read_signal_strength(struct dvb_frontend* fe, u16* strength) | |||
503 | usK = (rcvr_stat & 0x10) ? 3 : 0; | 504 | usK = (rcvr_stat & 0x10) ? 3 : 0; |
504 | 505 | ||
505 | /* The value reported back from the frontend will be FFFF=100% 0000=0% */ | 506 | /* The value reported back from the frontend will be FFFF=100% 0000=0% */ |
506 | *strength = (((8952 - i20Log10(snr_equ) - usK*100)/3+5)*65535)/1000; | 507 | signal_strength = (((8952 - i20Log10(snr_equ) - usK*100)/3+5)*65535)/1000; |
508 | if (signal_strength > 0xffff) | ||
509 | *strength = 0xffff; | ||
510 | else | ||
511 | *strength = signal_strength; | ||
507 | dprintk("read_signal_strength %i\n",*strength); | 512 | dprintk("read_signal_strength %i\n",*strength); |
508 | 513 | ||
509 | return 0; | 514 | return 0; |
diff --git a/drivers/media/dvb/frontends/or51211.c b/drivers/media/dvb/frontends/or51211.c index 8a9db23dd1b7..531f76246e5f 100644 --- a/drivers/media/dvb/frontends/or51211.c +++ b/drivers/media/dvb/frontends/or51211.c | |||
@@ -339,6 +339,7 @@ static int or51211_read_signal_strength(struct dvb_frontend* fe, u16* strength) | |||
339 | u8 rec_buf[2]; | 339 | u8 rec_buf[2]; |
340 | u8 snd_buf[4]; | 340 | u8 snd_buf[4]; |
341 | u8 snr_equ; | 341 | u8 snr_equ; |
342 | u32 signal_strength; | ||
342 | 343 | ||
343 | /* SNR after Equalizer */ | 344 | /* SNR after Equalizer */ |
344 | snd_buf[0] = 0x04; | 345 | snd_buf[0] = 0x04; |
@@ -358,8 +359,11 @@ static int or51211_read_signal_strength(struct dvb_frontend* fe, u16* strength) | |||
358 | snr_equ = rec_buf[0] & 0xff; | 359 | snr_equ = rec_buf[0] & 0xff; |
359 | 360 | ||
360 | /* The value reported back from the frontend will be FFFF=100% 0000=0% */ | 361 | /* The value reported back from the frontend will be FFFF=100% 0000=0% */ |
361 | *strength = (((5334 - i20Log10(snr_equ))/3+5)*65535)/1000; | 362 | signal_strength = (((5334 - i20Log10(snr_equ))/3+5)*65535)/1000; |
362 | 363 | if (signal_strength > 0xffff) | |
364 | *strength = 0xffff; | ||
365 | else | ||
366 | *strength = signal_strength; | ||
363 | dprintk("read_signal_strength %i\n",*strength); | 367 | dprintk("read_signal_strength %i\n",*strength); |
364 | 368 | ||
365 | return 0; | 369 | return 0; |