Commit 9dec0f48 authored by Sean Young's avatar Sean Young Committed by Mauro Carvalho Chehab

media: mceusb: sanity check for prescaler value

prescaler larger than 8 would mean the carrier is at most 152Hz,
which does not make sense for IR carriers.

Reported-by: syzbot+6d31bf169a8265204b8d@syzkaller.appspotmail.com
Signed-off-by: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent a6f42f5e
...@@ -701,11 +701,18 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, u8 *buf, int buf_len, ...@@ -701,11 +701,18 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, u8 *buf, int buf_len,
data[0], data[1]); data[0], data[1]);
break; break;
case MCE_RSP_EQIRCFS: case MCE_RSP_EQIRCFS:
if (!data[0] && !data[1]) {
dev_dbg(dev, "%s: no carrier", inout);
break;
}
// prescaler should make sense
if (data[0] > 8)
break;
period = DIV_ROUND_CLOSEST((1U << data[0] * 2) * period = DIV_ROUND_CLOSEST((1U << data[0] * 2) *
(data[1] + 1), 10); (data[1] + 1), 10);
if (!period) if (!period)
break; break;
carrier = (1000 * 1000) / period; carrier = USEC_PER_SEC / period;
dev_dbg(dev, "%s carrier of %u Hz (period %uus)", dev_dbg(dev, "%s carrier of %u Hz (period %uus)",
inout, carrier, period); inout, carrier, period);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment