xtensa: use strscpy to copy strings
authorJason Wang <wangborong@cdjrlc.com>
Mon, 20 Dec 2021 08:47:56 +0000 (16:47 +0800)
committerMax Filippov <jcmvbkbc@gmail.com>
Fri, 24 Dec 2021 11:12:45 +0000 (03:12 -0800)
commit71874374b46b52d9c44769209f9155313ce60452
treef75859e5aef4e53f1e78f0b2331ec2e93fa26dc1
parent56d55c151e0a9385c521766ed2fd580d7e9cb562
xtensa: use strscpy to copy strings

The strlcpy should not be used because it doesn't limit the source
length. So that it will lead some potential bugs.

But the strscpy doesn't require reading memory from the src string
beyond the specified "count" bytes, and since the return value is
easier to error-check than strlcpy()'s. In addition, the implementation
is robust to the string changing out from underneath it, unlike the
current strlcpy() implementation.

Thus, replace strlcpy with strscpy.

Signed-off-by: Jason Wang <wangborong@cdjrlc.com>
Message-Id: <20211220084756.955307-1-wangborong@cdjrlc.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
arch/xtensa/kernel/setup.c