staging: comedi: ni_at_a2150: range check board index
authorIan Abbott <abbotti@mev.co.uk>
Mon, 1 Sep 2014 13:13:30 +0000 (14:13 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 8 Sep 2014 20:44:22 +0000 (13:44 -0700)
commite988e1f3f975a9d6013c6356c5b9369540c091f9
treebe56538190e99343917a55656deac5e6c27620f7
parent395262a9e69042b82293f8b6bcd7a48b2fd215de
staging: comedi: ni_at_a2150: range check board index

The "ni_at_a2150" driver determines the board type by calling
`a2150_probe()`.  This reads a register and converts it to a board index
in the range 0 to 3.  However, the board table array it indexes into
(`a2150_boards[]`) only has 2 entries.  Return an error from the
Comedi driver "attach" handler `a2150_attach()` if the probed board
index is beyond the end of the array.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/ni_at_a2150.c