unifdef: use memcpy instead of strncpy 10/220810/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>
Mon, 23 Dec 2019 06:16:03 +0000 (15:16 +0900)
commit370016290f973e615a83829890fb1070275a8390
tree687035aad7f07f71b69b854dc17abc93bd24cbc7
parentc5642fe382ccf0f422c4aab16c6f0e219e4d7799
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-4.9.y commit 0d4a2de44713 for gcc 9 build]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I3adb0d708af7d8a55216d6c81d1e691b8d30e8c1
scripts/unifdef.c