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 ?
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(); } ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~