From: Sean Young <sean@mess.org>
To: linux-media@vger.kernel.org, Sean Young <sean@mess.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 2/5] media: rc: Prevent overflow in ir_raw_event_store_edge()
Date: Sun, 25 Oct 2026 18:13:42 +0000 [thread overview]
Message-ID: <e8d019982470fa2f9bf5f11729464e06d35a5faa.1792951808.git.sean@mess.org> (raw)
In-Reply-To: <cover.1792951808.git.sean@mess.org>
The value overflows every ~72 minutes. In between button presses,
this could result in a bogus duration which would prevent decode.
Signed-off-by: Sean Young <sean@mess.org>
---
drivers/media/rc/rc-ir-raw.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/media/rc/rc-ir-raw.c b/drivers/media/rc/rc-ir-raw.c
index 75dee4a483d4..a79fc89f0dc4 100644
--- a/drivers/media/rc/rc-ir-raw.c
+++ b/drivers/media/rc/rc-ir-raw.c
@@ -101,7 +101,8 @@ int ir_raw_event_store_edge(struct rc_dev *dev, bool pulse)
struct ir_raw_event ev = {};
now = ktime_get();
- ev.duration = ktime_to_us(ktime_sub(now, dev->raw->last_event));
+ ev.duration = min_t(u64, U32_MAX,
+ ktime_to_us(ktime_sub(now, dev->raw->last_event)));
ev.pulse = !pulse;
return ir_raw_event_store_with_timeout(dev, &ev);
--
2.56.0
next prev parent reply other threads:[~2026-10-25 18:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1792951808.git.sean@mess.org>
2026-10-25 18:13 ` [PATCH 1/5] media: rc: Remove pointless msleep() after request_module() Sean Young
2026-10-25 18:13 ` Sean Young [this message]
2026-10-25 18:13 ` [PATCH 3/5] media: rc: Do not touch rx state when unregistering a tx-only device Sean Young
2026-10-25 18:13 ` [PATCH 4/5] media: imon: Replace pr_err() with dev_err() and friends Sean Young
2026-10-25 18:13 ` [PATCH 5/5] media: rc: struct rc_map should have entries and capacity Sean Young
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e8d019982470fa2f9bf5f11729464e06d35a5faa.1792951808.git.sean@mess.org \
--to=sean@mess.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®