MIPS: Loongson2ef: Replace deprecated strncpy() with strscpy()

strncpy() is deprecated for NUL-terminated destination buffers. Use
strscpy() instead and remove the manual NUL-termination.

Compile-tested only.

Link: https://github.com/KSPP/linux/issues/90
Cc: linux-hardening@vger.kernel.org
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
This commit is contained in:
Thorsten Blum 2025-02-24 22:54:50 +01:00 committed by Thomas Bogendoerfer
parent 232085d118
commit 1bea9ab46d
1 changed files with 1 additions and 2 deletions

View File

@ -48,8 +48,7 @@ void __init prom_init_machtype(void)
return;
}
p += strlen("machtype=");
strncpy(str, p, MACHTYPE_LEN);
str[MACHTYPE_LEN] = '\0';
strscpy(str, p);
p = strstr(str, " ");
if (p)
*p = '\0';