• Prarit Bhargava's avatar
    kdb: Use strscpy with destination buffer size · c2b94c72
    Prarit Bhargava authored
    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: default avatarPrarit 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: default avatarDaniel Thompson <daniel.thompson@linaro.org>
    Signed-off-by: default avatarDaniel Thompson <daniel.thompson@linaro.org>
    c2b94c72
kdb_support.c 23.9 KB