]> git.baikalelectronics.ru Git - kernel.git/commit
net: qed: use correct strncpy() size
authorArnd Bergmann <arnd@arndb.de>
Fri, 2 Feb 2018 15:44:47 +0000 (16:44 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 3 Feb 2018 00:42:29 +0000 (19:42 -0500)
commit3d33709d3cfe5cc8ece916a01617d6c758425ff0
treeb898162dc492c9b755befaa473f548d92ed90092
parentf08ce78fb71d6f52100d9c18d52973f8c370ba72
net: qed: use correct strncpy() size

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>
drivers/net/ethernet/qlogic/qed/qed_debug.c