]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
staging: comedi: addi_apci_1500: Fix endian problem for command sample
authorIan Abbott <abbotti@mev.co.uk>
Tue, 23 Feb 2021 14:30:43 +0000 (14:30 +0000)
committerSeth Forshee <seth.forshee@canonical.com>
Wed, 17 Mar 2021 18:48:56 +0000 (13:48 -0500)
commit5296e68dacfc4f122cb6f927a7978892e14d365c
tree4b3ffe1a4814e9aa85a271ce6beb1ac888590d82
parentbc72c778fb1ef8c7c615696b07b9396034278a56
staging: comedi: addi_apci_1500: Fix endian problem for command sample

BugLink: https://bugs.launchpad.net/bugs/1919492
commit ac0bbf55ed3be75fde1f8907e91ecd2fd589bde3 upstream.

The digital input subdevice supports Comedi asynchronous commands that
read interrupt status information.  This uses 16-bit Comedi samples (of
which only the bottom 8 bits contain status information).  However, the
interrupt handler is calling `comedi_buf_write_samples()` with the
address of a 32-bit variable `unsigned int status`.  On a bigendian
machine, this will copy 2 bytes from the wrong end of the variable.  Fix
it by changing the type of the variable to `unsigned short`.

Fixes: a8c66b684efa ("staging: comedi: addi_apci_1500: rewrite the subdevice support functions")
Cc: <stable@vger.kernel.org> #4.0+
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20210223143055.257402-3-abbotti@mev.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
drivers/staging/comedi/drivers/addi_apci_1500.c