Re: [PATCH] EDAC/octeon: enlarge the L2C error message buffer
From: Thomas Bogendoerfer
Date: Sat Dec 05 2026 - 06:36:00 EST
On Sat, Nov 14, 2026 at 08:15:15PM +0800, Aibing Chen wrote:
> _octeon_l2c_poll_oct2() builds an error message by prefixing buf1 with a
> short description. buf1 holds up to 63 characters and the longest
> prefix is 33 characters ("Tag Single bit error (corrected):"), so the
> message needs up to 97 bytes, but buf2 is only 80 bytes.
>
> Building with W=1 reports a -Wformat-truncation warning for each of the
> six snprintf() calls, e.g. for "L2D Double bit error (detected):%s" the
> compiler notes that the output can reach 97 bytes including the
> terminator, into a destination of size 80. The printed message then
> loses the syndrome, type and way information that buf1 carries.
>
> Size buf2 for the worst case.
>
> Signed-off-by: Aibing Chen <chenaibing@xxxxxxxxxxxxxxxxxxxx>
> ---
> drivers/edac/octeon_edac-l2c.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/edac/octeon_edac-l2c.c b/drivers/edac/octeon_edac-l2c.c
> index e6b1595a3..5eca6e204 100644
> --- a/drivers/edac/octeon_edac-l2c.c
> +++ b/drivers/edac/octeon_edac-l2c.c
> @@ -62,7 +62,7 @@ static void _octeon_l2c_poll_oct2(struct edac_device_ctl_info *l2c, int tad)
> union cvmx_l2c_err_tdtx err_tdtx, err_tdtx_reset;
> union cvmx_l2c_err_ttgx err_ttgx, err_ttgx_reset;
> char buf1[64];
> - char buf2[80];
> + char buf2[128];
>
> err_tdtx_reset.u64 = 0;
> err_tdtx.u64 = cvmx_read_csr(CVMX_L2C_ERR_TDTX(tad));
applied to mips-next
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]