Thread (6 messages) 6 messages, 4 authors, 2021-07-31

Re: [PATCH] drivers/soc: Remove all strcpy() uses in favor of strscpy()

From: Len Baker <hidden>
Date: 2021-07-31 14:54:22
Also in: linux-arm-msm, linux-hardening, linux-renesas-soc, lkml

Hi,

On Wed, Jul 28, 2021 at 10:36:09AM +0100, Robin Murphy wrote:
On 2021-07-28 09:36, David Laight wrote:
quoted
quoted
quoted
-               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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help