linux-stable/drivers/edac
Arnd Bergmann 426fae93c0 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 15:44:37 -08:00
..
Kconfig EDAC/versal: Add a Xilinx Versal memory controller driver 2023-10-23 19:41:27 +02:00
Makefile EDAC/versal: Add a Xilinx Versal memory controller driver 2023-10-23 19:41:27 +02:00
al_mc_edac.c EDAC/al_mc: Make use of the helper function devm_add_action_or_reset() 2021-09-28 18:35:11 +02:00
altera_edac.c EDAC/altera: Remove MODULE_LICENSE in non-module 2023-04-01 13:18:50 +02:00
altera_edac.h
amd64_edac.c EDAC/amd64: Add support for AMD family 1Ah models 00h-1Fh and 40h-4Fh 2023-08-10 14:25:21 +02:00
amd64_edac.h - Add initial support for RAS hardware found on AMD server GPUs (MI200). 2023-06-26 15:09:18 -07:00
amd76x_edac.c EDAC: Do not issue useless debug statements in the polling routine 2020-10-26 12:59:56 +01:00
amd8111_edac.c EDAC/amd81[13]1: Remove trailing newline from MODULE_AUTHOR 2023-03-28 15:26:52 +02:00
amd8111_edac.h
amd8131_edac.c EDAC/amd81[13]1: Remove trailing newline from MODULE_AUTHOR 2023-03-28 15:26:52 +02:00
amd8131_edac.h
armada_xp_edac.c EDAC: Check for GHES preference in the chipset-specific EDAC drivers 2022-10-21 22:09:54 +02:00
aspeed_edac.c EDAC/aspeed: Use proper format string for printing resource 2021-05-18 16:33:13 +02:00
bluefield_edac.c
cell_edac.c
cpc925_edac.c
debugfs.c
dmc520_edac.c EDAC/dmc520: Don't print an error for each unconfigured interrupt line 2022-04-19 11:25:41 +02:00
e7xxx_edac.c EDAC: Sanitize MODULE_AUTHOR strings 2023-03-28 15:43:30 +02:00
e752x_edac.c EDAC: Sanitize MODULE_AUTHOR strings 2023-03-28 15:43:30 +02:00
edac_device.c EDAC/device: Respect any driver-supplied workqueue polling value 2023-01-19 11:43:16 +01:00
edac_device.h EDAC/device: Get rid of the silly one-shot memory allocation in edac_device_alloc_ctl_info() 2022-04-11 11:43:26 +02:00
edac_device_sysfs.c EDAC/sysfs: move to use bus_get_dev_root() 2023-03-22 09:25:49 +01:00
edac_mc.c EDAC/mc: Drop duplicated dimm->nr_pages debug printout 2022-09-01 08:52:18 +02:00
edac_mc.h
edac_mc_sysfs.c EDAC/mc_sysfs: Replace deprecated strncpy() with memcpy() 2023-09-29 14:48:32 -07:00
edac_module.c
edac_module.h EDAC/device: Fix period calculation in edac_device_reset_delay_period() 2022-12-30 15:51:41 +01:00
edac_pci.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_56.RULE (part 2) 2022-06-10 14:51:35 +02:00
edac_pci.h
edac_pci_sysfs.c EDAC/sysfs: move to use bus_get_dev_root() 2023-03-22 09:25:49 +01:00
fsl_ddr_edac.c EDAC: Explicitly include correct DT includes 2023-08-28 13:31:01 -05:00
fsl_ddr_edac.h treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_56.RULE (part 2) 2022-06-10 14:51:35 +02:00
ghes_edac.c EDAC/ghes: Make ghes_edac a proper module 2022-10-21 21:59:19 +02:00
highbank_l2_edac.c EDAC: Explicitly include correct DT includes 2023-08-28 13:31:01 -05:00
highbank_mc_edac.c EDAC: Explicitly include correct DT includes 2023-08-28 13:31:01 -05:00
i7core_edac.c * Add Amazon's Annapurna Labs memory controller EDAC driver, by Talel 2020-10-12 10:12:26 -07:00
i10nm_base.c Intel EDAC fixes: 2023-08-30 19:23:00 -07:00
i3000_edac.c EDAC: Do not issue useless debug statements in the polling routine 2020-10-26 12:59:56 +01:00
i3200_edac.c EDAC: Do not issue useless debug statements in the polling routine 2020-10-26 12:59:56 +01:00
i5000_edac.c EDAC: Sanitize MODULE_AUTHOR strings 2023-03-28 15:43:30 +02:00
i5100_edac.c EDAC: Sanitize MODULE_AUTHOR strings 2023-03-28 15:43:30 +02:00
i5400_edac.c EDAC/i5400: Fix typo in comment: vaious -> various 2022-11-25 19:29:02 +01:00
i7300_edac.c EDAC/i7300: Correct the i7300_exit() function name in comment 2022-09-23 23:07:17 +02:00
i82443bxgx_edac.c EDAC: Do not issue useless debug statements in the polling routine 2020-10-26 12:59:56 +01:00
i82860_edac.c EDAC: Sanitize MODULE_AUTHOR strings 2023-03-28 15:43:30 +02:00
i82875p_edac.c EDAC: Do not issue useless debug statements in the polling routine 2020-10-26 12:59:56 +01:00
i82975x_edac.c EDAC: Do not issue useless debug statements in the polling routine 2020-10-26 12:59:56 +01:00
ie31200_edac.c EDAC/ie31200: Add Skylake-S support 2022-08-25 10:28:01 +02:00
igen6_edac.c EDAC/igen6: Fix the issue of no error events 2023-08-02 13:09:56 -07:00
layerscape_edac.c EDAC: Sanitize MODULE_AUTHOR strings 2023-03-28 15:43:30 +02:00
mce_amd.c x86/MCE/AMD, EDAC/mce_amd: Decode UMC_V2 ECC errors 2023-06-05 12:27:11 +02:00
mce_amd.h
mpc85xx_edac.c EDAC: Explicitly include correct DT includes 2023-08-28 13:31:01 -05:00
mpc85xx_edac.h treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_56.RULE (part 2) 2022-06-10 14:51:35 +02:00
npcm_edac.c EDAC: Explicitly include correct DT includes 2023-08-28 13:31:01 -05:00
octeon_edac-l2c.c
octeon_edac-lmc.c
octeon_edac-pc.c
octeon_edac-pci.c
pasemi_edac.c
pnd2_edac.c EDAC: Check for GHES preference in the chipset-specific EDAC drivers 2022-10-21 22:09:54 +02:00
pnd2_edac.h
ppc4xx_edac.c EDAC/ppc_4xx: Reorder symbols to get rid of a few forward declarations 2022-09-18 19:35:22 +02:00
ppc4xx_edac.h
qcom_edac.c EDAC/qcom: Get rid of hardcoded register offsets 2023-05-26 20:56:55 -07:00
r82600_edac.c EDAC: Sanitize MODULE_AUTHOR strings 2023-03-28 15:43:30 +02:00
sb_edac.c EDAC: Check for GHES preference in the chipset-specific EDAC drivers 2022-10-21 22:09:54 +02:00
sifive_edac.c soc: sifive: ccache: Rename SiFive L2 cache to Composable cache. 2022-10-13 11:06:51 -07:00
skx_base.c EDAC/skx: Fix overflows on the DRAM row address mapping arrays 2023-03-13 10:42:00 -07:00
skx_common.c - Add a driver for the RAS functionality on Xilinx's on chip memory 2023-02-21 08:10:03 -08:00
skx_common.h EDAC/i10nm: Add Intel Granite Rapids server support 2023-01-25 08:17:30 -08:00
synopsys_edac.c EDAC: Explicitly include correct DT includes 2023-08-28 13:31:01 -05:00
thunderx_edac.c EDAC/thunderx: Fix possible out-of-bounds string access 2024-01-25 15:44:37 -08:00
ti_edac.c EDAC/ti: Remove redundant error messages 2021-10-07 19:16:01 +02:00
versal_edac.c EDAC/versal: Read num_csrows and num_chans using the correct bitfield macro 2023-12-15 13:01:27 +01:00
wq.c EDAC/wq: Remove unneeded flush_workqueue() 2022-08-25 10:50:35 +02:00
x38_edac.c EDAC: Do not issue useless debug statements in the polling routine 2020-10-26 12:59:56 +01:00
xgene_edac.c EDAC: Check for GHES preference in the chipset-specific EDAC drivers 2022-10-21 22:09:54 +02:00
zynqmp_edac.c EDAC/zynqmp: Add EDAC support for Xilinx ZynqMP OCM 2023-01-09 11:13:58 +01:00