From 3da4f8704df6a4959687b916ecfcbfcf3ab306d1 Mon Sep 17 00:00:00 2001 From: Sean Young Date: Fri, 5 Jan 2018 13:26:51 +0000 Subject: media: rc: clean up leader pulse/space for manchester encoding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ä Signed-off-by: Sean Young --- drivers/media/rc/rc-ir-raw.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'drivers/media/rc/rc-ir-raw.c') 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 { -- cgit v1.2.1