diff options
author | Michael Krufky <mkrufky@kernellabs.com> | 2009-09-27 13:05:12 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-11-07 09:55:04 -0500 |
commit | 4d8317876d5f53ef792e90f89d8f162d7bca5c81 (patch) | |
tree | 05da791adc6b44f828876a2bac6de97a397d9528 /drivers/media | |
parent | 7646b9de26c54cf4bc9c446d7ada9f91ece31e0a (diff) |
V4L/DVB (13107): tda18271: fix overflow in FM radio frequency calculation
Multiplication by 62500 causes an overflow in the 32 bit freq variable,
which is later divided by 1000 when using FM radio.
This patch prevents the overflow by scaling the frequency value correctly
upfront. Thanks to Henk Vergonet for spotting the problem and providing
a preliminary patch, which this changeset was based upon.
Cc: Henk Vergonet <Henk.Vergonet@gmail.com>
Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
CC: stable@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/common/tuners/tda18271-fe.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/media/common/tuners/tda18271-fe.c b/drivers/media/common/tuners/tda18271-fe.c index 64595112000d..cccaf164a8f9 100644 --- a/drivers/media/common/tuners/tda18271-fe.c +++ b/drivers/media/common/tuners/tda18271-fe.c | |||
@@ -1000,12 +1000,12 @@ static int tda18271_set_analog_params(struct dvb_frontend *fe, | |||
1000 | struct tda18271_std_map_item *map; | 1000 | struct tda18271_std_map_item *map; |
1001 | char *mode; | 1001 | char *mode; |
1002 | int ret; | 1002 | int ret; |
1003 | u32 freq = params->frequency * 62500; | 1003 | u32 freq = params->frequency * 125 * |
1004 | ((params->mode == V4L2_TUNER_RADIO) ? 1 : 1000) / 2; | ||
1004 | 1005 | ||
1005 | priv->mode = TDA18271_ANALOG; | 1006 | priv->mode = TDA18271_ANALOG; |
1006 | 1007 | ||
1007 | if (params->mode == V4L2_TUNER_RADIO) { | 1008 | if (params->mode == V4L2_TUNER_RADIO) { |
1008 | freq = freq / 1000; | ||
1009 | map = &std_map->fm_radio; | 1009 | map = &std_map->fm_radio; |
1010 | mode = "fm"; | 1010 | mode = "fm"; |
1011 | } else if (params->std & V4L2_STD_MN) { | 1011 | } else if (params->std & V4L2_STD_MN) { |