MIPS: Loongson2ef: Replace deprecated strncpy() with strscpy()
Subsystems (2)
PATCH 1/1 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.
Signed-off-by Thorsten Blum <[email protected]>
--- arch/mips/loongson2ef/common/machtype.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/mips/loongson2ef/common/machtype.c +1 -2
@@ -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' ;
Signature · 1 line
2.48.1
Quoted 28 lines · Thorsten Blum
strncpy()is deprecated for NUL-terminated destination buffers. Usestrscpy()instead and remove the manual NUL-termination.Compile-tested only.
Signed-off-by Thorsten Blum <[email protected]>--- arch/mips/loongson2ef/common/machtype.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)arch/mips/loongson2ef/common/machtype.c +1
-2@@ -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' ;Signature · 1 line
2.48.1
applied to mips-next.
Thomas.
Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]