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.

Fixes: 9b6192589be7 ("media: lirc: implement scancode sending")
Cc: stable@vger.kernel.org
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
This commit is contained in:
Sean Young 2023-10-06 22:31:52 +01:00 committed by Hans Verkuil
parent 4f7efc7189
commit c8a489f820

View File

@ -276,6 +276,10 @@ static ssize_t lirc_transmit(struct file *file, const char __user *buf,
if (ret < 0) if (ret < 0)
goto out_kfree_raw; goto out_kfree_raw;
/* drop trailing space */
if (!(ret % 2))
count = ret - 1;
else
count = ret; count = ret;
txbuf = kmalloc_array(count, sizeof(unsigned int), GFP_KERNEL); txbuf = kmalloc_array(count, sizeof(unsigned int), GFP_KERNEL);