diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2015-06-18 10:54:57 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-06-18 21:19:03 -0700 |
commit | e38576ce7301ddd5e39b969e3f2a136002fb429d (patch) | |
tree | 78426dc55083fe1f8dc8e3a31cafd80662693ac4 /drivers/staging | |
parent | adda9ab042326572237df7fd6be42f746206a385 (diff) | |
download | linux-stable-e38576ce7301ddd5e39b969e3f2a136002fb429d.tar.gz linux-stable-e38576ce7301ddd5e39b969e3f2a136002fb429d.tar.bz2 linux-stable-e38576ce7301ddd5e39b969e3f2a136002fb429d.zip |
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>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/comedi/drivers/vmk80xx.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/staging/comedi/drivers/vmk80xx.c b/drivers/staging/comedi/drivers/vmk80xx.c index a87b1523165e..3af075aa3946 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; |