[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210809162539.GB2619@titan>
Date: Mon, 9 Aug 2021 18:25:39 +0200
From: Len Baker <len.baker@....com>
To: Robert Richter <rric@...nel.org>
Cc: Len Baker <len.baker@....com>, Borislav Petkov <bp@...en8.de>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Tony Luck <tony.luck@...el.com>,
James Morse <james.morse@....com>,
Kees Cook <keescook@...omium.org>,
linux-hardening@...r.kernel.org, linux-edac@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] drivers/edac/edac_mc: Remove all strcpy() uses
Hi,
On Mon, Aug 09, 2021 at 11:51:54AM +0200, Robert Richter wrote:
> On 07.08.21 17:59:57, Len Baker wrote:
>
> > @@ -1113,11 +1115,11 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type,
> > p = e->label;
> > *p = '\0';
> > } else {
> > - if (p != e->label) {
> > - strcpy(p, OTHER_LABEL);
> > - p += strlen(OTHER_LABEL);
> > - }
> > - strcpy(p, dimm->label);
> > + const char *text = (p != e->label) ? OTHER_LABEL :
> > + dimm->label;
> > +
> > + strscpy(p, text, len);
> > + len -= strlen(p);
>
> The logic looks broken and dimm labels are not properly copied (the
> code should add an " or " separator between labels).
Apologies. My bad.
Regards,
Len
>
> > p += strlen(p);
> > }
> >
Powered by blists - more mailing lists