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

From: Borislav Petkov
Date: Mon Jul 25 2022 - 07:23:40 EST


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?

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette