Re: [PATCH] EDAC: enlarge the DIMM label buffer to cover the worst case
From: Aibing Chen
Date: Wed Dec 02 2026 - 21:14:00 EST
Hi Boris,
On Wed, Dec 03, 2026 at 05:14:35AM +0100, Borislav Petkov wrote:
> So you're basically saying that we should "fix" the code in order to
> accomodate gcc's wrong estimate? I.e., wag the dog?
Fair point - src_id and lmc are u8 and the channel/DIMM indices are small,
so the labels always fit in practice. The change only tries to keep the
build green.
> And a W= build should be -Werror?
> A W= build is there to issue those additional, false positive
> warnings and -Werror should be explicitly off there.
I don't think W=1 should imply -Werror either. What I hit is a different
thing: CONFIG_WERROR has "default COMPILE_TEST", so an allmodconfig build
with W=1 does turn these warnings into errors:
$ make allmodconfig
$ make W=1 drivers/edac/skx_common.o
drivers/edac/skx_common.c:790:87: error: '_DIMM#' directive output may be
truncated writing 6 bytes into a region of size between 0 and 9
[-Werror=format-truncation=]
cc1: all warnings being treated as errors
Given that, the options I see:
1. drop the patch - the labels are fine, gcc is just conservative;
2. use scnprintf() at the two call sites, which bounds the write and
does not grow struct dimm_info / edac_raw_error_desc;
3. keep the EDAC_MC_LABEL_LEN bump as sent.
I'm fine with 1 or 2 - which do you prefer?
Thanks,
Aibing