]> git.baikalelectronics.ru Git - kernel.git/commit
staging: comedi: verify array index is correct before using it
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 9 Jul 2020 10:29:36 +0000 (13:29 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Jul 2020 12:03:00 +0000 (14:03 +0200)
commit8198844cb9da5e8ed66c12b120f8608ce609151b
tree8f8707f25c62ad2a263acac276267a048d4e2e71
parent61e2f621850c69b0d73aa16517730d8f0a018b4b
staging: comedi: verify array index is correct before using it

This code reads from the array before verifying that "trig" is a valid
index.  If the index is wildly out of bounds then reading from an
invalid address could lead to an Oops.

Fixes: d48ef0ef1870 ("staging: comedi: addi_apci_1500: rewrite the subdevice support functions")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20200709102936.GA20875@mwanda
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/addi_apci_1500.c