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@xxxxxxxxxxxxxxxxxxx> --- v2: new patch drivers/staging/comedi/drivers/vmk80xx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/vmk80xx.c b/drivers/staging/comedi/drivers/vmk80xx.c index a87b152..3af075a 100644 --- a/drivers/staging/comedi/drivers/vmk80xx.c +++ b/drivers/staging/comedi/drivers/vmk80xx.c @@ -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; -- 2.4.3 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel