linux/drivers/comedi/drivers
Kees Cook 3bc93c7bde comedi: drivers: ni_routes: Use strcmp() instead of memcmp()
The family and device comparisons were using memcmp(), but this could
lead to Out-of-bounds reads when the length was larger than the
buffers being compared. Since these appear to always be NUL-terminated
strings, just use strcmp() instead.

This was found with Clang under LTO:

[ 92.405851][    T1] kernel BUG at lib/string_helpers.c:980!
...
[ 92.409141][ T1] RIP: 0010:fortify_panic (fbdev.c:?)
...
[ 92.410056][ T1] ni_assign_device_routes (fbdev.c:?)
[ 92.410056][ T1] ? unittest_enter (fbdev.c:?)
[ 92.410056][ T1] ni_routes_unittest (ni_routes_test.c:?)
[ 92.410056][ T1] ? unittest_enter (fbdev.c:?)
[ 92.410056][ T1] __initstub__kmod_ni_routes_test__505_604_ni_routes_unittest6 (fbdev.c:?)
[ 92.410056][ T1] do_one_initcall (fbdev.c:?)

Link: https://lore.kernel.org/lkml/20220210072821.GD4074@xsang-OptiPlex-9020
Fixes: 4bb90c87ab ("staging: comedi: add interface to ni routing table information")
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Spencer E. Olson <olsonse@umich.edu>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Lee Jones <lee.jones@linaro.org>
Reported-by: kernel test robot <oliver.sang@intel.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20220215171017.1247291-1-keescook@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-25 12:08:52 +01:00
..
ni_routing comedi: ni_routing: tools: Update due to moved COMEDI headers 2021-11-26 16:48:59 +01:00
tests
8255_pci.c comedi: Move and rename "8255.h" to <linux/comedi/comedi_8255.h> 2021-11-26 16:48:59 +01:00
8255.c comedi: Move and rename "8255.h" to <linux/comedi/comedi_8255.h> 2021-11-26 16:48:59 +01:00
addi_apci_3xxx.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
addi_apci_16xx.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
addi_apci_1032.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
addi_apci_1500.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
addi_apci_1516.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
addi_apci_1564.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
addi_apci_2032.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
addi_apci_2200.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
addi_apci_3120.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
addi_apci_3501.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
addi_tcw.h
addi_watchdog.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
addi_watchdog.h
adl_pci7x3x.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
adl_pci6208.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
adl_pci8164.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
adl_pci9111.c comedi: Move "comedi_8254.h" to <linux/comedi/comedi_8254.h> 2021-11-26 16:48:59 +01:00
adl_pci9118.c comedi: Move "comedi_8254.h" to <linux/comedi/comedi_8254.h> 2021-11-26 16:48:59 +01:00
adq12b.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
adv_pci1710.c comedi: Move "comedi_8254.h" to <linux/comedi/comedi_8254.h> 2021-11-26 16:48:59 +01:00
adv_pci1720.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
adv_pci1723.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
adv_pci1724.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
adv_pci1760.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
adv_pci_dio.c comedi: Move "comedi_8254.h" to <linux/comedi/comedi_8254.h> 2021-11-26 16:48:59 +01:00
aio_aio12_8.c comedi: Move "comedi_8254.h" to <linux/comedi/comedi_8254.h> 2021-11-26 16:48:59 +01:00
aio_iiro_16.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
amcc_s5933.h
amplc_dio200_common.c comedi: Move "comedi_8254.h" to <linux/comedi/comedi_8254.h> 2021-11-26 16:48:59 +01:00
amplc_dio200_pci.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
amplc_dio200.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
amplc_dio200.h
amplc_pc236_common.c comedi: Move and rename "8255.h" to <linux/comedi/comedi_8255.h> 2021-11-26 16:48:59 +01:00
amplc_pc236.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
amplc_pc236.h
amplc_pc263.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
amplc_pci224.c comedi: Move "comedi_8254.h" to <linux/comedi/comedi_8254.h> 2021-11-26 16:48:59 +01:00
amplc_pci230.c comedi: Move "comedi_8254.h" to <linux/comedi/comedi_8254.h> 2021-11-26 16:48:59 +01:00
amplc_pci236.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
amplc_pci263.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
c6xdigio.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
cb_das16_cs.c comedi: Move "comedi_8254.h" to <linux/comedi/comedi_8254.h> 2021-11-26 16:48:59 +01:00
cb_pcidas64.c comedi: Move and rename "8255.h" to <linux/comedi/comedi_8255.h> 2021-11-26 16:48:59 +01:00
cb_pcidas.c comedi: Move "comedi_8254.h" to <linux/comedi/comedi_8254.h> 2021-11-26 16:48:59 +01:00
cb_pcidda.c comedi: Move and rename "8255.h" to <linux/comedi/comedi_8255.h> 2021-11-26 16:48:59 +01:00
cb_pcimdas.c comedi: Move "comedi_8254.h" to <linux/comedi/comedi_8254.h> 2021-11-26 16:48:59 +01:00
cb_pcimdda.c comedi: Move and rename "8255.h" to <linux/comedi/comedi_8255.h> 2021-11-26 16:48:59 +01:00
comedi_8254.c comedi: Move "comedi_8254.h" to <linux/comedi/comedi_8254.h> 2021-11-26 16:48:59 +01:00
comedi_8255.c comedi: Move and rename "8255.h" to <linux/comedi/comedi_8255.h> 2021-11-26 16:48:59 +01:00
comedi_bond.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
comedi_isadma.c comedi: Move "comedi_isadma.h" to <linux/comedi/comedi_isadma.h> 2021-11-26 16:48:59 +01:00
comedi_parport.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
comedi_test.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
contec_pci_dio.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
dac02.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
daqboard2000.c comedi: Move and rename "8255.h" to <linux/comedi/comedi_8255.h> 2021-11-26 16:48:59 +01:00
das08_cs.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
das08_isa.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
das08_pci.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
das08.c comedi: Move "comedi_8254.h" to <linux/comedi/comedi_8254.h> 2021-11-26 16:48:59 +01:00
das08.h
das16.c comedi: das16: Use struct_size() helper in comedi_alloc_spriv() 2022-01-26 14:16:16 +01:00
das16m1.c comedi: Move "comedi_8254.h" to <linux/comedi/comedi_8254.h> 2021-11-26 16:48:59 +01:00
das800.c comedi: Move "comedi_8254.h" to <linux/comedi/comedi_8254.h> 2021-11-26 16:48:59 +01:00
das1800.c comedi: Move "comedi_isadma.h" to <linux/comedi/comedi_isadma.h> 2021-11-26 16:48:59 +01:00
das6402.c comedi: Move "comedi_8254.h" to <linux/comedi/comedi_8254.h> 2021-11-26 16:48:59 +01:00
dmm32at.c comedi: Move and rename "8255.h" to <linux/comedi/comedi_8255.h> 2021-11-26 16:48:59 +01:00
dt282x.c comedi: Move "comedi_isadma.h" to <linux/comedi/comedi_isadma.h> 2021-11-26 16:48:59 +01:00
dt2801.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
dt2811.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
dt2814.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
dt2815.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
dt2817.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
dt3000.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
dt9812.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
dyna_pci10xx.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
fl512.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
gsc_hpdi.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
icp_multi.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
ii_pci20kc.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
jr3_pci.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
jr3_pci.h
ke_counter.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
Makefile
me4000.c comedi: Move "comedi_8254.h" to <linux/comedi/comedi_8254.h> 2021-11-26 16:48:59 +01:00
me_daq.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
mf6x4.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
mite.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
mite.h
mpc624.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
multiq3.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
ni_65xx.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
ni_660x.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
ni_670x.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
ni_6527.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
ni_at_a2150.c comedi: Move "comedi_isadma.h" to <linux/comedi/comedi_isadma.h> 2021-11-26 16:48:59 +01:00
ni_at_ao.c comedi: Move "comedi_8254.h" to <linux/comedi/comedi_8254.h> 2021-11-26 16:48:59 +01:00
ni_atmio16d.c comedi: Move and rename "8255.h" to <linux/comedi/comedi_8255.h> 2021-11-26 16:48:59 +01:00
ni_atmio.c comedi: Move and rename "8255.h" to <linux/comedi/comedi_8255.h> 2021-11-26 16:48:59 +01:00
ni_daq_700.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
ni_daq_dio24.c comedi: Move and rename "8255.h" to <linux/comedi/comedi_8255.h> 2021-11-26 16:48:59 +01:00
ni_labpc_common.c comedi: Move "comedi_8254.h" to <linux/comedi/comedi_8254.h> 2021-11-26 16:48:59 +01:00
ni_labpc_cs.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
ni_labpc_isadma.c comedi: Move "comedi_isadma.h" to <linux/comedi/comedi_isadma.h> 2021-11-26 16:48:59 +01:00
ni_labpc_isadma.h
ni_labpc_pci.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
ni_labpc_regs.h
ni_labpc.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
ni_labpc.h
ni_mio_common.c comedi: Move and rename "8255.h" to <linux/comedi/comedi_8255.h> 2021-11-26 16:48:59 +01:00
ni_mio_cs.c comedi: Move and rename "8255.h" to <linux/comedi/comedi_8255.h> 2021-11-26 16:48:59 +01:00
ni_pcidio.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
ni_pcimio.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
ni_routes.c comedi: drivers: ni_routes: Use strcmp() instead of memcmp() 2022-02-25 12:08:52 +01:00
ni_routes.h comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
ni_stc.h
ni_tio_internal.h
ni_tio.c comedi: drivers: ni_tio: Fix slightly broken kernel-doc and demote others 2021-05-21 14:38:44 +02:00
ni_tio.h comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
ni_tiocmd.c
ni_usb6501.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
pcl711.c comedi: Move "comedi_8254.h" to <linux/comedi/comedi_8254.h> 2021-11-26 16:48:59 +01:00
pcl724.c comedi: Move and rename "8255.h" to <linux/comedi/comedi_8255.h> 2021-11-26 16:48:59 +01:00
pcl726.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
pcl730.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
pcl812.c comedi: Move "comedi_isadma.h" to <linux/comedi/comedi_isadma.h> 2021-11-26 16:48:59 +01:00
pcl816.c comedi: Move "comedi_isadma.h" to <linux/comedi/comedi_isadma.h> 2021-11-26 16:48:59 +01:00
pcl818.c comedi: Move "comedi_isadma.h" to <linux/comedi/comedi_isadma.h> 2021-11-26 16:48:59 +01:00
pcm3724.c comedi: remove redundant assignment to variable buffer_config 2022-02-08 12:12:02 +01:00
pcmad.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
pcmda12.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
pcmmio.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
pcmuio.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
plx9052.h
plx9080.h
quatech_daqp_cs.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
rtd520.c comedi: Move "comedi_8254.h" to <linux/comedi/comedi_8254.h> 2021-11-26 16:48:59 +01:00
rti800.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
rti802.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
s526.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
s626.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
s626.h
ssv_dnp.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
usbdux.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
usbduxfast.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
usbduxsigma.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
vmk80xx.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
z8536.h