linux-brain/drivers/edac
Robert Richter 857247a213 EDAC/mc: Fix edac_mc_find() in case no device is found
[ Upstream commit 29a0c84397 ]

The function should return NULL in case no device is found, but it
always returns the last checked mc device from the list even if the
index did not match. Fix that.

I did some analysis why this did not raise any issues for about 3 years
and the reason is that edac_mc_find() is mostly used to search for
existing devices. Thus, the bug is not triggered.

 [ bp: Drop the if (mci->mc_idx > idx) test in favor of readability. ]

Fixes: c73e8833be ("EDAC, mc: Fix locking around mc_devices list")
Signed-off-by: Robert Richter <rrichter@marvell.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: "linux-edac@vger.kernel.org" <linux-edac@vger.kernel.org>
Cc: James Morse <james.morse@arm.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Link: https://lkml.kernel.org/r/20190514104838.15065-1-rrichter@marvell.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-27 14:46:34 +01:00
..
altera_edac.c EDAC/altera: Use the proper type for the IRQ status bits 2019-10-05 12:47:48 +02:00
altera_edac.h EDAC, altera: Rename device trigger to common name 2016-09-01 08:55:24 +02:00
amd64_edac_dbg.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
amd64_edac_inj.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
amd64_edac.c EDAC/amd64: Decode syndrome before translating address 2019-10-05 12:47:54 +02:00
amd64_edac.h EDAC, amd64: Add Family 17h, models 10h-2fh support 2018-11-13 11:15:06 -08:00
amd76x_edac.c EDAC: Get rid of mci->mod_ver 2017-07-17 13:42:48 +02:00
amd8111_edac.c edac: rename edac_core.h to edac_mc.h 2016-12-15 08:54:51 -02:00
amd8111_edac.h edac: AMD8111 driver header file 2009-04-02 19:05:03 -07:00
amd8131_edac.c edac: rename edac_core.h to edac_mc.h 2016-12-15 08:54:51 -02:00
amd8131_edac.h tree-wide: fix comment/printk typos 2010-11-01 15:38:34 -04:00
cell_edac.c edac: rename edac_core.h to edac_mc.h 2016-12-15 08:54:51 -02:00
cpc925_edac.c EDAC, cpc925, ppc4xx: Convert to using %pOF instead of full_name 2017-07-19 07:42:41 +02:00
debugfs.c EDAC: Use edac_debugfs_remove_recursive() in edac_debugfs_exit() 2016-02-10 10:37:46 +01:00
e7xxx_edac.c EDAC: Get rid of mci->mod_ver 2017-07-17 13:42:48 +02:00
e752x_edac.c EDAC: Get rid of mci->mod_ver 2017-07-17 13:42:48 +02:00
edac_device_sysfs.c edac: move EDAC device definitions to drivers/edac/edac_device.h 2016-12-15 08:54:51 -02:00
edac_device.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
edac_device.h edac: move documentation from edac_device to edac_core.h 2016-12-15 08:54:51 -02:00
edac_mc_sysfs.c EDAC: Fix global-out-of-bounds write when setting edac_mc_poll_msec 2019-07-31 07:28:31 +02:00
edac_mc.c EDAC/mc: Fix edac_mc_find() in case no device is found 2020-01-27 14:46:34 +01:00
edac_mc.h EDAC: Add routine to check if MC devices list is empty 2017-01-28 14:36:47 +01:00
edac_module.c edac: rename edac_core.h to edac_mc.h 2016-12-15 08:54:51 -02:00
edac_module.h EDAC: Fix global-out-of-bounds write when setting edac_mc_poll_msec 2019-07-31 07:28:31 +02:00
edac_pci_sysfs.c edac: move documentation from edac_pci*.c to edac_pci.h 2016-12-15 08:54:51 -02:00
edac_pci.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
edac_pci.h edac: move documentation from edac_pci*.c to edac_pci.h 2016-12-15 08:54:51 -02:00
fsl_ddr_edac.c EDAC, fsl_ddr: Make locally used symbols static 2017-02-09 17:40:54 +01:00
fsl_ddr_edac.h EDAC, fsl_ddr: Add missing DDR DRAM types 2016-09-01 10:28:01 +02:00
ghes_edac.c EDAC/ghes: Fix grain calculation 2019-12-31 12:37:36 +01:00
highbank_l2_edac.c edac: rename edac_core.h to edac_mc.h 2016-12-15 08:54:51 -02:00
highbank_mc_edac.c EDAC: Get rid of mci->mod_ver 2017-07-17 13:42:48 +02:00
i7core_edac.c EDAC, {i7core,sb,skx}_edac: Fix uncorrected error counting 2018-11-13 11:15:06 -08:00
i3000_edac.c EDAC: Get rid of mci->mod_ver 2017-07-17 13:42:48 +02:00
i3200_edac.c EDAC: Get rid of mci->mod_ver 2017-07-17 13:42:48 +02:00
i5000_edac.c EDAC: Get rid of mci->mod_ver 2017-07-17 13:42:48 +02:00
i5100_edac.c EDAC: Get rid of mci->mod_ver 2017-07-17 13:42:48 +02:00
i5400_edac.c EDAC: Get rid of mci->mod_ver 2017-07-17 13:42:48 +02:00
i7300_edac.c EDAC: Get rid of mci->mod_ver 2017-07-17 13:42:48 +02:00
i82443bxgx_edac.c EDAC: Get rid of mci->mod_ver 2017-07-17 13:42:48 +02:00
i82860_edac.c EDAC: Get rid of mci->mod_ver 2017-07-17 13:42:48 +02:00
i82875p_edac.c EDAC: Get rid of mci->mod_ver 2017-07-17 13:42:48 +02:00
i82975x_edac.c EDAC: Get rid of mci->mod_ver 2017-07-17 13:42:48 +02:00
ie31200_edac.c EDAC: Get rid of mci->mod_ver 2017-07-17 13:42:48 +02:00
Kconfig EDAC/mpc85xx: Prevent building as a module 2019-06-15 11:54:52 +02:00
layerscape_edac.c edac: rename edac_core.h to edac_mc.h 2016-12-15 08:54:51 -02:00
Makefile EDAC: Delete edac_stub.c 2017-04-10 17:14:48 +02:00
mce_amd.c x86/mce/AMD, EDAC/mce_amd: Enumerate Reserved SMCA bank type 2018-04-19 08:56:20 +02:00
mce_amd.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mpc85xx_edac.c EDAC, mpc85xx: Add T2080 l2-cache support 2017-02-03 10:36:35 +01:00
mpc85xx_edac.h EDAC, fsl-ddr: Separate FSL DDR driver from MPC85xx 2016-09-01 10:28:00 +02:00
mv64x60_edac.c EDAC, mv64x60: Fix an error handling path 2018-04-12 12:32:19 +02:00
mv64x60_edac.h edac: Drop __DATE__ usage 2011-04-19 00:23:22 +02:00
octeon_edac-l2c.c edac: rename edac_core.h to edac_mc.h 2016-12-15 08:54:51 -02:00
octeon_edac-lmc.c EDAC, octeon: Fix an uninitialized variable warning 2018-02-16 20:23:07 +01:00
octeon_edac-pc.c edac: rename edac_core.h to edac_mc.h 2016-12-15 08:54:51 -02:00
octeon_edac-pci.c edac: rename edac_core.h to edac_mc.h 2016-12-15 08:54:51 -02:00
pasemi_edac.c edac: rename edac_core.h to edac_mc.h 2016-12-15 08:54:51 -02:00
pnd2_edac.c EDAC, pnd2: Fix ioremap() size in dnv_rd_reg() 2019-10-05 12:47:49 +02:00
pnd2_edac.h EDAC, pnd2_edac: Add new EDAC driver for Intel SoC platforms 2017-03-16 12:40:52 +01:00
ppc4xx_edac.c EDAC, cpc925, ppc4xx: Convert to using %pOF instead of full_name 2017-07-19 07:42:41 +02:00
ppc4xx_edac.h edac: new ppc4xx driver module 2009-04-02 19:05:03 -07:00
r82600_edac.c EDAC: Get rid of mci->mod_ver 2017-07-17 13:42:48 +02:00
sb_edac.c EDAC, sb_edac: Return early on ADDRV bit and address type test 2019-11-20 17:59:51 +01:00
skx_edac.c EDAC, skx_edac: Fix logical channel intermediate decoding 2018-11-13 11:15:06 -08:00
synopsys_edac.c EDAC: Get rid of mci->mod_ver 2017-07-17 13:42:48 +02:00
thunderx_edac.c EDAC, thunderx: Fix memory leak in thunderx_l2c_threaded_isr() 2019-12-01 09:13:19 +01:00
tile_edac.c edac: rename edac_core.h to edac_mc.h 2016-12-15 08:54:51 -02:00
wq.c EDAC, wq: Remove deprecated create_singlethread_workqueue() 2016-08-15 07:21:29 +02:00
x38_edac.c EDAC: Get rid of mci->mod_ver 2017-07-17 13:42:48 +02:00
xgene_edac.c EDAC: Get rid of mci->mod_ver 2017-07-17 13:42:48 +02:00