Skip to content

Commit

Permalink
media: lirc: drop trailing space from scancode transmit
Browse files Browse the repository at this point in the history
commit c8a489f upstream.

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: 9b61925 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
seanyoung authored and gregkh committed Nov 28, 2023
1 parent 526dd75 commit 41c2690
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/media/rc/lirc_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 41c2690

Please sign in to comment.