summaryrefslogtreecommitdiff
path: root/drivers/media/rc/rc-ir-raw.c
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2018-01-05 16:26:51 +0300
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2018-01-23 15:26:50 +0300
commitddf9c1bb3d2ae24a216237d8195bb31ff632d8e5 (patch)
treeba9dcf0d8b1e87c6e3f67c4e4f5af6c2798e7993 /drivers/media/rc/rc-ir-raw.c
parente3cd973429ff7d05480b3889a9a6f4b658083137 (diff)
downloadlinux-ddf9c1bb3d2ae24a216237d8195bb31ff632d8e5.tar.xz
media: rc: clean up leader pulse/space for manchester encoding
The IR rc6 encoder sends the header using manchester encoding using 0 bits, which causes the following: UBSAN: Undefined behaviour in drivers/media/rc/rc-ir-raw.c:247:6 shift exponent 4294967295 is too large for 64-bit type 'long long unsigned int' So, allow the leader code to send a pulse and space and remove the unused pulse_space_start field. Cc: Antti Seppälä <a.seppala@gmail.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/rc/rc-ir-raw.c')
-rw-r--r--drivers/media/rc/rc-ir-raw.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/media/rc/rc-ir-raw.c b/drivers/media/rc/rc-ir-raw.c
index 3dabb783a1f0..8500b57923c0 100644
--- a/drivers/media/rc/rc-ir-raw.c
+++ b/drivers/media/rc/rc-ir-raw.c
@@ -246,17 +246,15 @@ int ir_raw_gen_manchester(struct ir_raw_event **ev, unsigned int max,
i = BIT_ULL(n - 1);
- if (timings->leader) {
+ if (timings->leader_pulse) {
if (!max--)
return ret;
- if (timings->pulse_space_start) {
- init_ir_raw_event_duration((*ev)++, 1, timings->leader);
-
+ init_ir_raw_event_duration((*ev), 1, timings->leader_pulse);
+ if (timings->leader_space) {
if (!max--)
return ret;
- init_ir_raw_event_duration((*ev), 0, timings->leader);
- } else {
- init_ir_raw_event_duration((*ev), 1, timings->leader);
+ init_ir_raw_event_duration(++(*ev), 0,
+ timings->leader_space);
}
i >>= 1;
} else {