mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sparc: vio: Replace snprintf with strscpy in vio_create_one
@ 2026-01-31 22:44 Thorsten Blum
  2026-02-06 10:38 ` Andreas Larsson
  0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-01-31 22:44 UTC (permalink / raw)
  To: David S. Miller, Andreas Larsson; +Cc: Thorsten Blum, sparclinux, linux-kernel

Replace snprintf("%s", ...) with the faster and more direct strscpy().

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 arch/sparc/kernel/vio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/sparc/kernel/vio.c b/arch/sparc/kernel/vio.c
index 1a1a9d6b8f2e..8c7dd72ef334 100644
--- a/arch/sparc/kernel/vio.c
+++ b/arch/sparc/kernel/vio.c
@@ -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);
-- 
Thorsten Blum <thorsten.blum@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6  9D84 7336 78FD 8DFE EAD4


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] sparc: vio: Replace snprintf with strscpy in vio_create_one
  2026-01-31 22:44 [PATCH] sparc: vio: Replace snprintf with strscpy in vio_create_one Thorsten Blum
@ 2026-02-06 10:38 ` Andreas Larsson
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Larsson @ 2026-02-06 10:38 UTC (permalink / raw)
  To: Thorsten Blum, David S. Miller; +Cc: sparclinux, linux-kernel

On 2026-01-31 23:44, Thorsten Blum wrote:
> Replace snprintf("%s", ...) with the faster and more direct strscpy().
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
>  arch/sparc/kernel/vio.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/sparc/kernel/vio.c b/arch/sparc/kernel/vio.c
> index 1a1a9d6b8f2e..8c7dd72ef334 100644
> --- a/arch/sparc/kernel/vio.c
> +++ b/arch/sparc/kernel/vio.c
> @@ -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);

Reviewed-by: Andreas Larsson <andreas@gaisler.com>

Picking this up to my for-next.

Thanks,
Andreas


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-02-06 10:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-31 22:44 [PATCH] sparc: vio: Replace snprintf with strscpy in vio_create_one Thorsten Blum
2026-02-06 10:38 ` Andreas Larsson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome