Re: [PATCH] staging: comedi: usbdux: bug fix for accessing 'ao_chanlist' in private data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Indeed! That had been unnoticed for about 8 years! Well done Harley.

/Bernd

Ian Abbott wrote:
[Sorry for the repeated email. One of the addresses I was replying to was corrupted.]

On 2014-03-28 16:20, H Hartley Sweeten wrote:
In usbdux_ao_cmd(), the channels for the command are transfered from the
cmd->chanlist and stored in the private data 'ao_chanlist'. The channel
numbers are bit-shifted when stored so that they become the "command"
that is transfered to the device. The channel to command conversion
results in the 'ao_chanlist' having these values for the channels:

   channel 0 -> ao_chanlist = 0x00
   channel 1 -> ao_chanlist = 0x40
   channel 2 -> ao_chanlist = 0x80
   channel 3 -> ao_chanlist = 0xc0

The problem is, the usbduxsub_ao_isoc_irq() function uses the 'chan' value
from 'ao_chanlist' to access the 'ao_readback' array in the private data.
So instead of accessing the array as 0, 1, 2, 3, it accesses it as 0x00,
0x40, 0x80, 0xc0.

Fix this by storing the raw channel number in 'ao_chanlist' and doing the
bit-shift when creating the command.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Bernd Porr <mail@xxxxxxxxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

Nice catch! Another one to add to my list of stable kernel comedi bugs that need fixing.

Reviewed-by: Ian Abbott <abbotti@xxxxxxxxx>


--
http://www.berndporr.me.uk
http://www.linux-usb-daq.co.uk
http://www.imdb.com/name/nm3293421/
+44 (0)7840 340069
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux