]> git.baikalelectronics.ru Git - kernel.git/commit
kdb: Use strscpy with destination buffer size
authorPrarit Bhargava <prarit@redhat.com>
Thu, 20 Sep 2018 12:59:14 +0000 (08:59 -0400)
committerDaniel Thompson <daniel.thompson@linaro.org>
Tue, 13 Nov 2018 20:27:53 +0000 (20:27 +0000)
commit74d3f2a61622a8a8f412aadf05a88ad145374c32
treea38909e62dae0ea7c75f7bcc63f375bacd594f96
parent7239dca98c3b27a4646a8b9b71ed9b5c91ad0597
kdb: Use strscpy with destination buffer size

gcc 8.1.0 warns with:

kernel/debug/kdb/kdb_support.c: In function ‘kallsyms_symbol_next’:
kernel/debug/kdb/kdb_support.c:239:4: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
     strncpy(prefix_name, name, strlen(name)+1);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/debug/kdb/kdb_support.c:239:31: note: length computed here

Use strscpy() with the destination buffer size, and use ellipses when
displaying truncated symbols.

v2: Use strscpy()

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: Jonathan Toppins <jtoppins@redhat.com>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Cc: kgdb-bugreport@lists.sourceforge.net
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
kernel/debug/kdb/kdb_io.c
kernel/debug/kdb/kdb_private.h
kernel/debug/kdb/kdb_support.c