diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2012-09-11 07:11:24 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-10-06 09:24:39 -0300 |
commit | 48cafec9a941c2dfe94d76642662bc20bf87fe08 (patch) | |
tree | 135943901bfccdb6a8e260fed60c6583fcc8021b /drivers/media/rc/nuvoton-cir.c | |
parent | a52eb6c02fa27efb5f8980312785fce1f77377e2 (diff) |
[media] rc: divide by zero bugs in s_tx_carrier()
"carrier" comes from a get_user() in ir_lirc_ioctl(). We need to test
that it's not zero before using it as a divisor. It might have been
nice to test for this ir_lirc_ioctl() but the mceusb driver uses zero to
disable carrier modulation.
The bug in redrat3 is a little more subtle. The ->carrier is passed to
mod_freq_to_val() which uses it as a divisor.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/rc/nuvoton-cir.c')
-rw-r--r-- | drivers/media/rc/nuvoton-cir.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c index 699eef39128..2ea913a44ae 100644 --- a/drivers/media/rc/nuvoton-cir.c +++ b/drivers/media/rc/nuvoton-cir.c @@ -517,6 +517,9 @@ static int nvt_set_tx_carrier(struct rc_dev *dev, u32 carrier) struct nvt_dev *nvt = dev->priv; u16 val; + if (carrier == 0) + return -EINVAL; + nvt_cir_reg_write(nvt, 1, CIR_CP); val = 3000000 / (carrier) - 1; nvt_cir_reg_write(nvt, val & 0xff, CIR_CC); |