unifdef: use memcpy instead of strncpy 44/220944/1
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 30 Nov 2018 22:45:01 +0000 (14:45 -0800)
committerDongkyun Son <dongkyun.s@samsung.com>
Thu, 26 Dec 2019 03:51:35 +0000 (12:51 +0900)
commit34e5786b4b06ffcdff209ceb11b70eee49886cb5
tree8653e35f42805e47d120fc1e8182fca2368d8bf7
parent3384a409183653d0736b91d0dd68675acea0104e
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>
[dongkyun.s: cherry-pick stable linux-4.9.y commit 37370fadd2da for gcc 9 build]

Change-Id: I2f005aa7c6642d76d818f1fda7722f345095b8a9
scripts/unifdef.c