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 sent a log of the warnings attached to
this email; 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 ?
--
Chris Ward