Arnd Bergmann
71c17ee025
EDAC/thunderx: Fix possible out-of-bounds string access
...
[ Upstream commit 475c58e1a471e9b873e3e39958c64a2d278275c8 ]
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:33:31 -08:00
Dan Carpenter
b95998fb6c
EDAC, thunderx: Fix memory leak in thunderx_l2c_threaded_isr()
...
[ Upstream commit d8c27ba86a2fd806d3957e5a9b30e66dfca2a61d ]
Fix memory leak in L2c threaded interrupt handler.
[ bp: Rewrite commit message. ]
Fixes: 41003396f9 ("EDAC, thunderx: Add Cavium ThunderX EDAC driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com >
Signed-off-by: Borislav Petkov <bp@suse.de >
CC: David Daney <david.daney@cavium.com >
CC: Jan Glauber <jglauber@cavium.com >
CC: Mauro Carvalho Chehab <mchehab@kernel.org >
CC: Sergey Temerkhanov <s.temerkhanov@gmail.com >
CC: linux-edac <linux-edac@vger.kernel.org >
Link: http://lkml.kernel.org/r/20181013102843.GG16086@mwanda
Signed-off-by: Sasha Levin <sashal@kernel.org >
2019-12-01 09:16:18 +01:00
Kees Cook
6663484b4e
EDAC, thunderx: Remove VLA usage
...
In the quest to remove all stack VLA usage from the kernel[1], switch to
using a kmalloc-allocated buffer instead of stack space. This should be
fine since the existing routine is allocating memory too.
Signed-off-by: Kees Cook <keescook@chromium.org >
Acked-by: Jan Glauber <jglauber@cavium.com >
Cc: David Daney <david.daney@cavium.com >
Cc: linux-edac <linux-edac@vger.kernel.org >
Link: http://lkml.kernel.org/r/20180629184850.GA37464@beast
Link: https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qPXydAacU1RqZWA@mail.gmail.com [1]
Signed-off-by: Borislav Petkov <bp@suse.de >
2018-07-09 11:33:02 +02:00
Jan Glauber
f821fe8cc7
EDAC, thunderx: Remove suspend/resume support
...
The memory controller on ThunderX/OcteonTX systems does not support
power management. Therefore remove the suspend/resume callbacks.
Signed-off-by: Jan Glauber <jglauber@cavium.com >
Cc: David Daney <david.daney@cavium.com >
Cc: Jan Glauber <jglauber@cavium.com >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Mauro Carvalho Chehab <mchehab@kernel.org >
Cc: Ralf Baechle <ralf@linux-mips.org >
Cc: Suzuki K Poulose <Suzuki.Poulose@arm.com >
Cc: Will Deacon <will.deacon@arm.com >
Cc: Zhangshaokun <zhangshaokun@hisilicon.com >
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-edac <linux-edac@vger.kernel.org >
Cc: linux-mips@linux-mips.org
Link: http://lkml.kernel.org/r/20170925123502.17289-2-jglauber@cavium.com
Signed-off-by: Borislav Petkov <bp@suse.de >
2017-09-27 17:35:58 +02:00
Christophe JAILLET
3eaef0fa39
EDAC, thunderx: Fix error handling path in thunderx_lmc_probe()
...
Return the proper error value if ioremap() fails (and not 0).
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr >
Cc: David Daney <david.daney@cavium.com >
Cc: Ralf Baechle <ralf@linux-mips.org >
Cc: linux-edac <linux-edac@vger.kernel.org >
Cc: linux-mips@linux-mips.org
Link: http://lkml.kernel.org/r/20170816045821.14165-1-christophe.jaillet@wanadoo.fr
[ Massage commit message, remove newline. ]
Signed-off-by: Borislav Petkov <bp@suse.de >
2017-08-18 19:12:08 +02:00
Borislav Petkov
c54182ec0e
EDAC: Get rid of mci->mod_ver
...
It is a write-only variable so get rid of it.
Signed-off-by: Borislav Petkov <bp@suse.de >
Acked-by: Robert Richter <rric@kernel.org >
Acked-by: Michal Simek <michal.simek@xilinx.com >
Acked-by: Thor Thayer <thor.thayer@linux.intel.com >
Acked-by: Tony Luck <tony.luck@intel.com >
Cc: Mark Gross <mark.gross@intel.com >
Cc: Tim Small <tim@buttersideup.com >
Cc: Ranganathan Desikan <ravi@jetztechnologies.com >
Cc: "Arvind R." <arvino55@gmail.com >
Cc: Jason Baron <jbaron@akamai.com >
Cc: "Sören Brinkmann" <soren.brinkmann@xilinx.com >
Cc: Ralf Baechle <ralf@linux-mips.org >
Cc: David Daney <david.daney@cavium.com >
Cc: Loc Ho <lho@apm.com >
Cc: linux-edac@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-mips@linux-mips.org
2017-07-17 13:42:48 +02:00
Vadim Lomovtsev
cf97825862
EDAC, thunderx: Fix a warning during l2c debugfs node creation
...
Compare the number of debugfs entries created by
thunderx_create_debugfs_nodes() with the requested number of entries to
properly determine whether to print a warning.
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com >
Cc: linux-edac <linux-edac@vger.kernel.org >
Cc: linux-mips@linux-mips.org
Link: http://lkml.kernel.org/r/20170531155157.93583-1-stemerkhanov@cavium.com
Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com >
Signed-off-by: Borislav Petkov <bp@suse.de >
2017-06-01 20:08:17 +02:00
Sergey Temerkhanov
5195c206fd
EDAC, thunderx: Remove unused code
...
Remove unused code reserved for upcoming CPUs.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com >
Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com >
Cc: David Daney <david.daney@cavium.com >
Cc: Jan.Glauber@cavium.com
Cc: linux-edac <linux-edac@vger.kernel.org >
Link: http://lkml.kernel.org/r/20170406113834.17153-1-s.temerkhanov@gmail.com
Signed-off-by: Borislav Petkov <bp@suse.de >
2017-04-07 11:49:32 +02:00
Sergey Temerkhanov
3d2d8c0f84
EDAC, thunderx: Change LMC index calculation
...
Shift the node number by 3 bits instead of 8 allowing proper functioning
with default EDAC_MAX_MCS.
Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com >
Cc: David Daney <david.daney@cavium.com >
Cc: Jan.Glauber@cavium.com
Cc: linux-edac <linux-edac@vger.kernel.org >
Link: http://lkml.kernel.org/r/20170406113755.17082-1-s.temerkhanov@gmail.com
Signed-off-by: Borislav Petkov <bp@suse.de >
2017-04-07 11:47:44 +02:00
Jan Glauber
621c4fe3cc
EDAC, thunderx: Fix L2C MCI interrupt disable
...
Fix a typo that disabled the MCI interrupts using the wrong bitmask.
Signed-off-by: Jan Glauber <jglauber@cavium.com >
Cc: David Daney <david.daney@cavium.com >
Cc: Ralf Baechle <ralf@linux-mips.org >
Cc: Sergey Temerkhanov <s.temerkhanov@gmail.com >
Cc: linux-edac <linux-edac@vger.kernel.org >
Link: http://lkml.kernel.org/r/20170405102739.6301-1-jglauber@cavium.com
Signed-off-by: Borislav Petkov <bp@suse.de >
2017-04-05 14:46:05 +02:00
Sergey Temerkhanov
41003396f9
EDAC, thunderx: Add Cavium ThunderX EDAC driver
...
Add support for Cavium ThunderX EDAC capable on-chip peripherals, namely
the DRAM controller (LMC), cache coherent processor interconnect (CCPI)
and level 2 cache blocks (L2C-TAD, L2C-MCI, L2C-CBC)
Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com >
Cc: David.Daney@cavium.com
Cc: Jan.Glauber@cavium.com
Cc: linux-edac <linux-edac@vger.kernel.org >
Link: http://lkml.kernel.org/r/20170324222837.60583-1-s.temerkhanov@gmail.com
Signed-off-by: Borislav Petkov <bp@suse.de >
2017-03-27 11:43:56 +02:00