Commit 21e4db6d authored by Linus Torvalds's avatar Linus Torvalds Committed by Stefan Bader

test_hexdump: use memcpy instead of strncpy

BugLink: https://bugs.launchpad.net/bugs/1818813

commit b1286ed7 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.

Apparently there was a patch for this floating around earlier, but it
got lost.
Acked-again-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent acabd67a
...@@ -81,7 +81,7 @@ static void __init test_hexdump(size_t len, int rowsize, int groupsize, ...@@ -81,7 +81,7 @@ static void __init test_hexdump(size_t len, int rowsize, int groupsize,
const char *q = *result++; const char *q = *result++;
size_t amount = strlen(q); size_t amount = strlen(q);
strncpy(p, q, amount); memcpy(p, q, amount);
p += amount + 1; p += amount + 1;
} }
if (i) if (i)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment