]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
sparc: vio: Replace snprintf with strscpy in vio_create_one
authorThorsten Blum <thorsten.blum@linux.dev>
Sat, 31 Jan 2026 22:44:11 +0000 (23:44 +0100)
committerAndreas Larsson <andreas@gaisler.com>
Fri, 6 Feb 2026 14:15:09 +0000 (15:15 +0100)
Replace snprintf("%s", ...) with the faster and more direct strscpy().

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/vio.c

index 1a1a9d6b8f2e8dfedefafde846315a06a167fbfb..8c7dd72ef334dc162b40b407f32aeb24e6b50f49 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <linux/kernel.h>
 #include <linux/slab.h>
+#include <linux/string.h>
 #include <linux/irq.h>
 #include <linux/export.h>
 #include <linux/init.h>
@@ -378,8 +379,7 @@ static struct vio_dev *vio_create_one(struct mdesc_handle *hp, u64 mp,
         * the parent doesn't require the MD node info.
         */
        if (node_name != NULL) {
-               (void) snprintf(vdev->node_name, VIO_MAX_NAME_LEN, "%s",
-                               node_name);
+               strscpy(vdev->node_name, node_name);
 
                err = mdesc_get_node_info(hp, mp, node_name,
                                          &vdev->md_node_info);