staging: comedi: vmk80xx: sanity check context used to get the boardinfo

As done in all the comedi drivers that auto attach, sanity check the
passed context that is used to get the boardinfo.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
H Hartley Sweeten 2015-06-18 10:54:57 -07:00 committed by Greg Kroah-Hartman
parent adda9ab042
commit e38576ce73

View File

@ -795,7 +795,10 @@ static int vmk80xx_auto_attach(struct comedi_device *dev,
struct vmk80xx_private *devpriv;
int ret;
board = &vmk80xx_boardinfo[context];
if (context < ARRAY_SIZE(vmk80xx_boardinfo))
board = &vmk80xx_boardinfo[context];
if (!board)
return -ENODEV;
dev->board_ptr = board;
dev->board_name = board->name;