]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
sparc64: Replace deprecated strcpy() with strscpy() in build_path_component()
authorThorsten Blum <thorsten.blum@linux.dev>
Mon, 22 Sep 2025 21:03:56 +0000 (23:03 +0200)
committerAndreas Larsson <andreas@gaisler.com>
Fri, 26 Sep 2025 15:27:35 +0000 (17:27 +0200)
strcpy() is deprecated; use strscpy() instead.

No functional changes intended.

Link: https://github.com/KSPP/linux/issues/88
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: Andreas Larsson <andreas@gaisler.com>
Signed-off-by: Andreas Larsson <andreas@gaisler.com>
arch/sparc/kernel/prom_64.c

index ba82884cb92aa38b2403a1144277c49a99a81cb0..aa4799cbb9c1d11e9425867fb790e65dd2de1ebf 100644 (file)
@@ -361,14 +361,16 @@ char * __init build_path_component(struct device_node *dp)
 {
        const char *name = of_get_property(dp, "name", NULL);
        char tmp_buf[64], *n;
+       size_t n_sz;
 
        tmp_buf[0] = '\0';
        __build_path_component(dp, tmp_buf);
        if (tmp_buf[0] == '\0')
-               strcpy(tmp_buf, name);
+               strscpy(tmp_buf, name);
 
-       n = prom_early_alloc(strlen(tmp_buf) + 1);
-       strcpy(n, tmp_buf);
+       n_sz = strlen(tmp_buf) + 1;
+       n = prom_early_alloc(n_sz);
+       strscpy(n, tmp_buf, n_sz);
 
        return n;
 }