Re: [PATCH v4 11/12] EDAC/ghes: Small buffer fixes for mem other_detail helpers
From: Pierre Gondois
Date: Wed Nov 25 2026 - 11:30:55 EST
Hello Borislav,
On 11/24/26 05:30, Borislav Petkov wrote:
On Fri, Nov 13, 2026 at 02:24:53PM +0100, Pierre Gondois wrote:
scnprintf() already reserves space for the terminating NULL,Fixes go *first* in a patchset. Then you don't have to fix a function you just
leaving one byte unused and under-flowing the capacity when len=0.
Callers also remove the last character unconditionally, which
can discard valid text after truncation.
Update the following functions to fix the above issues.
- print_mem_error_other_detail()
- print_mem_error2_other_detail()
Signed-off-by: Pierre Gondois<pierre.gondois@xxxxxxx>
---
drivers/edac/ghes_edac.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
added in your patchset.
Since the functions are effectively duplicated logic but must be
distinct as operating on different structures, I thought it would
be easier to review to first add the function duplicates and then
fix the 2 functions the same way.
I'll re-organize the patches following an order close to what
Yazen suggested at:
https://lore.kernel.org/all/20261124151417.GB2156781@xxxxxxxxxxxxxxxxx/
I might take some 'fix' patches from:
https://lore.kernel.org/all/20261117111444.4185512-1-pierre.gondois@xxxxxxx/
when possible/necessary.
Also, the patch subject should have a verb.Ok sure
Also, those functions you're touching here look to me like they're duplicating
a bunch of code...
I think this is what was advised by Jonathan at:
https://lore.kernel.org/all/20261014094744.00007c0c@xxxxxxxxxxxxxxxx/
Regards,
Pierre