net: qed: use correct strncpy() size
authorArnd Bergmann <arnd@arndb.de>
Fri, 2 Feb 2018 15:44:47 +0000 (16:44 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 8 Dec 2018 12:05:09 +0000 (13:05 +0100)
commit11de2fae3441670b5b9d7a287a33bfb6dff93af5
tree4e729fd16f1bf426e63f3b160c44decc7084b0d2
parentf3e31bbef6ed3c2787e75cd3b03fa88c530fb943
net: qed: use correct strncpy() size

commit 11f711081af0eb54190dc0de96ba4a9cd494666b upstream.

passing the strlen() of the source string as the destination
length is pointless, and gcc-8 now warns about it:

drivers/net/ethernet/qlogic/qed/qed_debug.c: In function 'qed_grc_dump':
include/linux/string.h:253: error: 'strncpy' specified bound depends on the length of the source argument [-Werror=stringop-overflow=]

This changes qed_grc_dump_big_ram() to instead uses the length of
the destination buffer, and use strscpy() to guarantee nul-termination.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/qlogic/qed/qed_debug.c