Skip to content

Commit fd3ce65

Browse files
ian-abbottgregkh
authored andcommitted
staging: comedi: pcl726: Use 16-bit 0 for interrupt data
The pcl726 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-15-abbotti@mev.co.uk Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 5ff1c08 commit fd3ce65

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/staging/comedi/drivers/pcl726.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,11 @@ static irqreturn_t pcl726_interrupt(int irq, void *d)
220220
struct pcl726_private *devpriv = dev->private;
221221

222222
if (devpriv->cmd_running) {
223+
unsigned short val = 0;
224+
223225
pcl726_intr_cancel(dev, s);
224226

225-
comedi_buf_write_samples(s, &s->state, 1);
227+
comedi_buf_write_samples(s, &val, 1);
226228
comedi_handle_events(dev, s);
227229
}
228230

0 commit comments

Comments
 (0)