]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
test_hexdump: use memcpy instead of strncpy
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 30 Nov 2018 20:13:15 +0000 (12:13 -0800)
committerSultan Alsawaf <sultan.alsawaf@canonical.com>
Wed, 24 Jul 2019 15:45:00 +0000 (09:45 -0600)
commit3bdf2ddcccf447bfdde6299b12e55b26fbd99d1e
tree40b1e23f45a99518e7c1fd71b466707a9182d25c
parent779e035d1808b721215e2e90657685f172e05245
test_hexdump: use memcpy instead of strncpy

BugLink: https://bugs.launchpad.net/bugs/1837161
commit b1286ed7158e9b62787508066283ab0b8850b518 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: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
lib/test_hexdump.c