Commit e38576ce authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

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: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent adda9ab0
...@@ -795,7 +795,10 @@ static int vmk80xx_auto_attach(struct comedi_device *dev, ...@@ -795,7 +795,10 @@ static int vmk80xx_auto_attach(struct comedi_device *dev,
struct vmk80xx_private *devpriv; struct vmk80xx_private *devpriv;
int ret; int ret;
if (context < ARRAY_SIZE(vmk80xx_boardinfo))
board = &vmk80xx_boardinfo[context]; board = &vmk80xx_boardinfo[context];
if (!board)
return -ENODEV;
dev->board_ptr = board; dev->board_ptr = board;
dev->board_name = board->name; dev->board_name = board->name;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment