linux-stable/drivers/edac
Arnd Bergmann 5da3b6e719 EDAC/thunderx: Fix possible out-of-bounds string access
[ Upstream commit 475c58e1a4 ]

Enabling -Wstringop-overflow globally exposes a warning for a common bug
in the usage of strncat():

  drivers/edac/thunderx_edac.c: In function 'thunderx_ocx_com_threaded_isr':
  drivers/edac/thunderx_edac.c:1136:17: error: 'strncat' specified bound 1024 equals destination size [-Werror=stringop-overflow=]
   1136 |                 strncat(msg, other, OCX_MESSAGE_SIZE);
        |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   ...
   1145 |                                 strncat(msg, other, OCX_MESSAGE_SIZE);
   ...
   1150 |                                 strncat(msg, other, OCX_MESSAGE_SIZE);

   ...

Apparently the author of this driver expected strncat() to behave the
way that strlcat() does, which uses the size of the destination buffer
as its third argument rather than the length of the source buffer. The
result is that there is no check on the size of the allocated buffer.

Change it to strlcat().

  [ bp: Trim compiler output, fixup commit message. ]

Fixes: 41003396f9 ("EDAC, thunderx: Add Cavium ThunderX EDAC driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20231122222007.3199885-1-arnd@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-01-25 14:34:21 -08:00
..
Kconfig ARM updates for 5.4-rc1: 2019-09-22 09:39:09 -07:00
Makefile ARM updates for 5.4-rc1: 2019-09-22 09:39:09 -07:00
altera_edac.c EDAC/altera: Fix deferred probing 2022-02-08 18:24:34 +01:00
altera_edac.h edac: altera: Move Stratix10 SDRAM ECC to peripheral 2019-07-25 14:28:42 -04:00
amd64_edac.c EDAC/amd64: Handle three rank interleaving mode 2021-11-17 09:48:36 +01:00
amd64_edac.h EDAC/amd64: Add AMD family 17h model 60h PCI IDs 2020-06-22 09:31:20 +02:00
amd64_edac_dbg.c
amd64_edac_inj.c
amd76x_edac.c
amd8111_edac.c
amd8111_edac.h
amd8131_edac.c
amd8131_edac.h
armada_xp_edac.c EDAC/armada-xp: Fix output of uncorrectable error counter 2021-10-20 11:40:14 +02:00
aspeed_edac.c EDAC/aspeed: Fix handling of platform_get_irq() error 2020-10-29 09:57:29 +01:00
bluefield_edac.c EDAC, mellanox: Add ECC support for BlueField DDR4 2019-08-08 12:57:01 -03:00
cell_edac.c
cpc925_edac.c
debugfs.c ARM: 8892/1: EDAC: Add missing debugfs_create_x32 wrapper 2019-08-29 07:58:01 +01:00
e7xxx_edac.c
e752x_edac.c
edac_device.c EDAC/device: Respect any driver-supplied workqueue polling value 2023-02-06 07:52:44 +01:00
edac_device.h
edac_device_sysfs.c EDAC: Fix reference count leaks 2020-08-19 08:15:54 +02:00
edac_mc.c EDAC: Fix calculation of returned address and next offset in edac_align_ptr() 2022-02-23 11:59:59 +01:00
edac_mc.h EDAC: Prefer 'unsigned int' to bare use of 'unsigned' 2019-09-03 19:21:19 +02:00
edac_mc_sysfs.c EDAC/mc: Fix use-after-free and memleaks during device removal 2020-02-19 19:53:03 +01:00
edac_module.c
edac_module.h EDAC/device: Fix period calculation in edac_device_reset_delay_period() 2023-01-18 11:42:03 +01:00
edac_pci.c
edac_pci.h
edac_pci_sysfs.c EDAC: Fix reference count leaks 2020-08-19 08:15:54 +02:00
fsl_ddr_edac.c
fsl_ddr_edac.h
ghes_edac.c EDAC/ghes: Check whether the driver is on the safe list correctly 2020-10-01 13:18:14 +02:00
highbank_l2_edac.c
highbank_mc_edac.c EDAC/highbank: Fix memory leak in highbank_mc_probe() 2023-02-06 07:52:35 +01:00
i7core_edac.c EDAC/{i7core,sb,pnd2,skx}: Fix error event severity 2020-09-03 11:26:53 +02:00
i10nm_base.c EDAC/i10nm: fix refcount leak in pci_get_dev_wrapper() 2023-01-18 11:40:55 +01:00
i3000_edac.c
i3200_edac.c
i5000_edac.c
i5100_edac.c EDAC/i5100: Fix error handling order in i5100_init_one() 2020-10-29 09:57:29 +01:00
i5400_edac.c
i7300_edac.c
i82443bxgx_edac.c
i82860_edac.c
i82875p_edac.c
i82975x_edac.c
ie31200_edac.c EDAC/ie31200: Fallback if host bridge device is already initialized 2020-09-03 11:26:48 +02:00
layerscape_edac.c
mce_amd.c EDAC/mce_amd: Use struct cpuinfo_x86.cpu_die_id for AMD NodeId 2020-12-30 11:51:10 +01:00
mce_amd.h
mpc85xx_edac.c
mpc85xx_edac.h
mv64x60_edac.c
mv64x60_edac.h
octeon_edac-l2c.c
octeon_edac-lmc.c
octeon_edac-pc.c
octeon_edac-pci.c
pasemi_edac.c
pnd2_edac.c EDAC/Intel: Do not load EDAC driver when running as a guest 2021-07-14 16:53:18 +02:00
pnd2_edac.h
ppc4xx_edac.c
ppc4xx_edac.h
qcom_edac.c EDAC/qcom: Do not pass llcc_driv_data as edac_device_ctl_info's pvt_info 2023-02-06 07:52:44 +01:00
r82600_edac.c
sb_edac.c EDAC/sb_edac: Fix top-of-high-memory value for Broadwell/Haswell 2021-11-17 09:48:22 +01:00
sifive_edac.c EDAC/sifive: Fix return value check in ecc_register() 2020-02-24 08:36:51 +01:00
skx_base.c EDAC/skx: Fix overflows on the DRAM row address mapping arrays 2023-05-17 11:35:35 +02:00
skx_common.c EDAC/{i7core,sb,pnd2,skx}: Fix error event severity 2020-09-03 11:26:53 +02:00
skx_common.h EDAC/skx: Use the mcmtr register to retrieve close_pg/bank_xor_enable 2020-06-17 16:40:33 +02:00
synopsys_edac.c EDAC/synopsys: Read the error count from the correct register 2022-04-27 13:50:48 +02:00
thunderx_edac.c EDAC/thunderx: Fix possible out-of-bounds string access 2024-01-25 14:34:21 -08:00
ti_edac.c EDAC/ti: Add missing MODULE_DEVICE_TABLE 2021-07-14 16:53:16 +02:00
wq.c
x38_edac.c
xgene_edac.c EDAC/xgene: Fix deferred probing 2022-02-08 18:24:34 +01:00