kdb: Fix bound check compiler warning
[ Upstream commit ca976bfb3154c7bc67c4651ecd144fdf67ccaee7 ] The strncpy() function may leave the destination string buffer unterminated, better use strscpy() instead. This fixes the following warning with gcc 8.2: kernel/debug/kdb/kdb_io.c: In function 'kdb_getstr': kernel/debug/kdb/kdb_io.c:449:3: warning: 'strncpy' specified bound 256 equals destination size [-Wstringop-truncation] strncpy(kdb_prompt_str, prompt, CMD_BUFLEN); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by:Wenlin Kang <wenlin.kang@windriver.com> Signed-off-by:
Daniel Thompson <daniel.thompson@linaro.org> Stable-dep-of: 70867efacf43 ("kdb: address -Wformat-security warnings") Signed-off-by:
Sasha Levin <sashal@kernel.org> (cherry picked from commit b15593e2904d2ff0094b7170f806dba0eeefac75) Signed-off-by:
Vegard Nossum <vegard.nossum@oracle.com>
Loading
Please register or sign in to comment