mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
media: meson-ir-tx: Prevent divide by zero in meson_irtx_prepare_pulse()
If an excesively high carrier is set, meson_irtx_prepare_pulse() will
cause a divide by zero if tb_us is 0. Prevent such a carrier from being
set.
Fixes: 49be1c78d5 ("media: rc: introduce Meson IR TX driver")
Signed-off-by: Sean Young <sean@mess.org>
Cc: stable@vger.kernel.org
Acked-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
parent
27303392aa
commit
05d9c515cf
|
|
@ -219,6 +219,9 @@ static int meson_irtx_set_carrier(struct rc_dev *rc, u32 carrier)
|
|||
if (carrier == 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (!DIV_ROUND_CLOSEST(USEC_PER_SEC, carrier))
|
||||
return -EINVAL;
|
||||
|
||||
ir->carrier = carrier;
|
||||
meson_irtx_set_mod(ir);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user