unifdef: use memcpy instead of strncpy
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 30 Nov 2018 22:45:01 +0000 (14:45 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 8 Dec 2018 12:05:05 +0000 (13:05 +0100)
commit0d4a2de44713ddc65bf4087e1424a55fa79f4a5c
tree524543d82f2efed01b80b3dea1b44589b7faa759
parentcd39e296c4d65a4598c882d17373ca5ec99d7416
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>
scripts/unifdef.c