[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240627162008.GA76758@yaz-khff2.amd.com>
Date: Thu, 27 Jun 2024 12:20:08 -0400
From: Yazen Ghannam <yazen.ghannam@....com>
To: Borislav Petkov <bp@...en8.de>, Avadhut Naik <Avadhut.Naik@....com>
Cc: "Naik, Avadhut" <avadnaik@....com>, Avadhut Naik <avadhut.naik@....com>,
x86@...nel.org, linux-edac@...r.kernel.org,
linux-trace-kernel@...r.kernel.org, linux-acpi@...r.kernel.org,
linux-kernel@...r.kernel.org, tony.luck@...el.com,
rafael@...nel.org, tglx@...utronix.de, mingo@...hat.com,
rostedt@...dmis.org, lenb@...nel.org, mchehab@...nel.org,
james.morse@....com, airlied@...il.com, john.allen@....com
Subject: Re: [PATCH v2 4/4] EDAC/mce_amd: Add support for FRU Text in MCA
On Wed, Jun 26, 2024 at 08:20:13PM +0200, Borislav Petkov wrote:
> On Wed, Jun 26, 2024 at 01:00:30PM -0500, Naik, Avadhut wrote:
> > >
> > > Why are you clearing it if you're overwriting it immediately?
> > >
> > Since its a local variable, wanted to ensure that the memory is zeroed out to prevent
> > any issues with the %s specifier, used later on.
>
> What issues?
>
> > Would you recommend removing that and using initializer instead for the string?
>
> I'd recommend looking at what the code does and then really thinking whether
> that makes any sense.
>
We need to make sure the string is NULL-terminated. So the memset()
could be replaced with this:
frutext[16] = '\0';
Or better yet, maybe we can use scnprintf() or similar.
Thanks,
Yazen
Powered by blists - more mailing lists