[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20231007123133.6718-1-sean@mess.org>
Date: Sat, 7 Oct 2023 13:31:33 +0100
From: Sean Young <sean@...s.org>
To: linux-media@...r.kernel.org,
Mauro Carvalho Chehab <mchehab@...nel.org>
Cc: stable@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] media: lirc: drop trailing space from scancode transmit
When transmitting, infrared drivers expect an odd number of samples; iow
without a trailing space. No problems have been observed so far, so
this is just belt and braces.
Cc: stable@...r.kernel.org
Signed-off-by: Sean Young <sean@...s.org>
---
drivers/media/rc/lirc_dev.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c
index 043d23aaa3cb..a537734832c5 100644
--- a/drivers/media/rc/lirc_dev.c
+++ b/drivers/media/rc/lirc_dev.c
@@ -276,7 +276,11 @@ static ssize_t lirc_transmit(struct file *file, const char __user *buf,
if (ret < 0)
goto out_kfree_raw;
- count = ret;
+ /* drop trailing space */
+ if (!(ret % 2))
+ count = ret - 1;
+ else
+ count = ret;
txbuf = kmalloc_array(count, sizeof(unsigned int), GFP_KERNEL);
if (!txbuf) {
--
2.42.0
Powered by blists - more mailing lists