linux-hardening.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Len Baker <len.baker@gmx.com>
To: Robin Murphy <robin.murphy@arm.com>,
	David Laight <David.Laight@ACULAB.COM>,
	'Geert Uytterhoeven' <geert@linux-m68k.org>
Cc: Len Baker <len.baker@gmx.com>, Kees Cook <keescook@chromium.org>,
	Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Magnus Damm <magnus.damm@gmail.com>,
	Santosh Shilimkar <ssantosh@kernel.org>,
	"linux-hardening@vger.kernel.org"
	<linux-hardening@vger.kernel.org>,
	linux-arm-msm <linux-arm-msm@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] drivers/soc: Remove all strcpy() uses in favor of strscpy()
Date: Sat, 31 Jul 2021 16:53:59 +0200	[thread overview]
Message-ID: <20210731140620.GC1979@titan> (raw)
In-Reply-To: <fa2fd44d-8cd7-b700-2e7b-d88c9c52507d@arm.com>

Hi,

On Wed, Jul 28, 2021 at 10:36:09AM +0100, Robin Murphy wrote:
> On 2021-07-28 09:36, David Laight wrote:

> > > > -               strcpy(pd->name, area->name);
> > > > +               strscpy(pd->name, area->name, area_name_size);
> >
> > You can just use memcpy().
>
> Indeed. In fact I'd go as far as saying that it might be worth teaching
> static checkers to recognise patterns that boil down to strscpy(dst, src,
> strlen(src) + 1) and flag them as suspect, because AFAICS that would always
> represent either an unnecessarily elaborate memcpy(), or far worse just an
> obfuscated strcpy().

Ok, I will use the memcpy function instead of strscpy. Thanks for the
feedback.

>
> Robin.

Regards,
Len

  reply	other threads:[~2021-07-31 14:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-25 15:14 Len Baker
2021-07-26  8:03 ` Geert Uytterhoeven
2021-07-28  8:36   ` David Laight
2021-07-28  9:36     ` Robin Murphy
2021-07-31 14:53       ` Len Baker [this message]
2021-07-31 13:59   ` Len Baker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210731140620.GC1979@titan \
    --to=len.baker@gmx.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=agross@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=geert@linux-m68k.org \
    --cc=keescook@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=robin.murphy@arm.com \
    --cc=ssantosh@kernel.org \
    --subject='Re: [PATCH] drivers/soc: Remove all strcpy() uses in favor of strscpy()' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).