]> git.proxmox.com Git - mirror_ubuntu-bionic-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)
committerSultan Alsawaf <sultan.alsawaf@canonical.com>
Wed, 24 Jul 2019 15:45:02 +0000 (09:45 -0600)
commit5bf3db78762c036f27f90dc7c6449fdb89491e40
treed66e5fa613f5aa5cd1906024e5eea2243c7003c4
parent491bfb62ce17d849c3d6f897ab31022bafb6974c
net: qed: use correct strncpy() size

BugLink: https://bugs.launchpad.net/bugs/1837161
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>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/net/ethernet/qlogic/qed/qed_debug.c