Skip to content

Commit a084303

Browse files
ian-abbottgregkh
authored andcommitted
staging: comedi: pcl711: Fix endian problem for AI command data
The analog input subdevice supports Comedi asynchronous commands that use Comedi's 16-bit sample format. However, the call to `comedi_buf_write_samples()` is passing the address of a 32-bit integer variable. On bigendian machines, this will copy 2 bytes from the wrong end of the 32-bit value. Fix it by changing the type of the variable holding the sample value to `unsigned short`. Fixes: 1f44c03 ("staging: comedi: pcl711: use comedi_buf_write_samples()") Cc: <stable@vger.kernel.org> # 3.19+ Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Link: https://lore.kernel.org/r/20210223143055.257402-9-abbotti@mev.co.uk Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b39dfcc commit a084303

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/staging/comedi/drivers/pcl711.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ static irqreturn_t pcl711_interrupt(int irq, void *d)
184184
struct comedi_device *dev = d;
185185
struct comedi_subdevice *s = dev->read_subdev;
186186
struct comedi_cmd *cmd = &s->async->cmd;
187-
unsigned int data;
187+
unsigned short data;
188188

189189
if (!dev->attached) {
190190
dev_err(dev->class_dev, "spurious interrupt\n");

0 commit comments

Comments
 (0)