Re: [PATCH v2] EDAC/ghes: Fix buffer overflow in ghes_edac_register()

From: Robert Richter
Date: Mon Jul 25 2022 - 07:30:53 EST


On 25.07.22 13:23:26, Borislav Petkov wrote:
> On Mon, Jul 25, 2022 at 01:09:11PM +0200, Robert Richter wrote:
> > I see now, what you mean here, may be change this:
> >
> > snprintf(dimm->label, sizeof(dimm->label), "%s %s",
> > (bank && *bank) ? bank : "N/A",
> > (device && *device) ? device : "N/A");
> >
> > to:
> >
> > snprintf(dimm->label, sizeof(dimm->label), "%s%s%s",
> > (bank && *bank) ? bank : "",
> > (bank && device) ? " " : "",
> > (device && *device) ? device : "");
> >
> > It keeps the default assignment from edac_mc_alloc_dimms() but changes
> > we label if one of bank or device is given.
>
> Yap, that should take care of all possible "configurations" BIOS throws
> at us.
>
> Toshi, could you pls add this to the fix and test it on your machine to
> make sure it still works as expected?

If you like, you can add my:

Signed-off-by: Robert Richter <rrichter@xxxxxxx>

-Robert