diff options
author | Sean Young | 2018-05-10 07:37:51 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab | 2018-05-14 07:12:11 -0400 |
commit | d4589935ebab0f75bbb191ce2cb14c5f8f4f9429 (patch) | |
tree | f6c33e809b2f6a142c194e1a8fbe83dff9f27cc7 /drivers/media/rc/mceusb.c | |
parent | aec3eadfb642346669c4d9324d82b5844e36a39b (diff) |
media: mceusb: filter out bogus timing irdata of duration 0
A mceusb device has been observed producing invalid irdata. Proactively
guard against this.
Suggested-by: Matthias Reichl <hias@horus.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/rc/mceusb.c')
-rw-r--r-- | drivers/media/rc/mceusb.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c index 1619b748469b..1ca49491abc8 100644 --- a/drivers/media/rc/mceusb.c +++ b/drivers/media/rc/mceusb.c @@ -1177,6 +1177,11 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len) init_ir_raw_event(&rawir); rawir.pulse = ((ir->buf_in[i] & MCE_PULSE_BIT) != 0); rawir.duration = (ir->buf_in[i] & MCE_PULSE_MASK); + if (unlikely(!rawir.duration)) { + dev_warn(ir->dev, "nonsensical irdata %02x with duration 0", + ir->buf_in[i]); + break; + } if (rawir.pulse) { ir->pulse_tunit += rawir.duration; ir->pulse_count++; |