Bug 201629 - Build warnings when I compile the linux kernel
Summary: Build warnings when I compile the linux kernel
Status: NEW
Alias: None
Product: Other
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: other_other
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-07 13:27 UTC by Chris Ward
Modified: 2018-11-09 12:13 UTC (History)
0 users

See Also:
Kernel Version: 4.18
Subsystem:
Regression: No
Bisected commit-id:


Attachments
Log of kernel build warnings (57.14 KB, text/plain)
2018-11-07 13:27 UTC, Chris Ward
Details

Description Chris Ward 2018-11-07 13:27:44 UTC
Created attachment 279371 [details]
Log of kernel build warnings

I recently had reason to build the Linux kernel (debugging a problem on OpenSuSE Tumbleweed), and I

got a number of warnings. They are all about 'strncpy' buffers being possibly 1 byte too short to hold the

trailing NUL in a string. I have attached a log of these warings; the first warning is here

as a sample.

  CC      kernel/debug/kdb/kdb_io.o
kernel/debug/kdb/kdb_io.c: In function ‘kdb_getstr’:
kernel/debug/kdb/kdb_io.c:446:3: warning: ‘strncpy’ specified bound 256 equals destination size [-Wstringop-truncation]
   strncpy(kdb_prompt_str, prompt, CMD_BUFLEN);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Should the kernel be revised to eliminate these warnings ?
Comment 1 Chris Ward 2018-11-09 12:13:19 UTC
The 'master' branch of https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git is much cleaner now; the warnings I get are

  CC      kernel/debug/kdb/kdb_support.o
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
    strncpy(prefix_name, name, strlen(name)+1);

                               ^~~~~~~~~~~~

  CC [M]  drivers/net/wireless/quantenna/qtnfmac/commands.o
drivers/net/wireless/quantenna/qtnfmac/commands.c: In function ‘qtnf_cmd_send_with_reply’:
drivers/net/wireless/quantenna/qtnfmac/commands.c:133:54: warning: ‘resp’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   return qtnf_cmd_resp_result_decode(le16_to_cpu(resp->result));

   HOSTCC  scripts/unifdef
scripts/unifdef.c: In function ‘Mpass’:
scripts/unifdef.c:453:28: warning: ‘strncpy’ output truncated before terminating nul copying 4 bytes from a string of the same length [-Wstringop-truncation]
 static void Mpass (void) { strncpy(keyword, "if  ", 4); Pelif(); }
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                     ^~

Note You need to log in before you can comment on or make changes to this bug.