unifdef: use memcpy instead of strncpy 34/220334/1
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 30 Nov 2018 22:45:01 +0000 (14:45 -0800)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Tue, 17 Dec 2019 05:41:12 +0000 (14:41 +0900)
commit4020e02add15cc429829c56fee89bc995f72324e
tree48554c3d7c45961240ef577b3cc8864ffcc81445
parent26c4a6c3cdaf2cde035a4d3d6d339a88a1610bf7
unifdef: use memcpy instead of strncpy

commit 38c7b224ce22c25fed04007839edf974bd13439d upstream.

New versions of gcc reasonably warn about the odd pattern of

strncpy(p, q, strlen(q));

which really doesn't make sense: the strncpy() ends up being just a slow
and odd way to write memcpy() in this case.

There was a comment about _why_ the code used strncpy - to avoid the
terminating NUL byte, but memcpy does the same and avoids the warning.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[sw0312.kim: cherry-pick stable linux-3.18.y commit c6c893b2dabf for gcc 9 build]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I220d1195b95a76841c6efce4f16455640191406a
scripts/unifdef.c