staging: comedi: ni_6527: Use 16-bit 0 for interrupt data
authorIan Abbott <abbotti@mev.co.uk>
Tue, 23 Feb 2021 14:30:53 +0000 (14:30 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Mar 2021 08:23:29 +0000 (09:23 +0100)
commit33444638ae54fa2eb8e9269d70ce2d5bc8b52751
tree35951031ab215259936b97e961fcac8a0412e33e
parenta1acdbc55403d94ac8dddcb0311360bc6dae659f
staging: comedi: ni_6527: Use 16-bit 0 for interrupt data

The ni_6527 driver has an "interrupt" subdevice that supports Comedi
asynchronous commands, placing a value in the Comedi buffer for each
interrupt.  The subdevice uses Comedi's 16-bit sample format but the
interrupt handler is calling `comedi_buf_write_samples()` with the
address of a 32-bit integer `&s->state`.  On bigendian machines, this
will copy 2 bytes from the wrong end of the 32-bit integer.  This isn't
really a problem since `s->state` will always be 0 for this subdevice,
but clean it up by using a 16-bit variable initialized to 0 to pass the
value.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20210223143055.257402-13-abbotti@mev.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/ni_6527.c