mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] staging: vme_user: use scnprintf in tsi148_alloc_resource
@ 2026-10-21  3:13 LiuJunyuan
  2026-10-21  6:01 ` Dan Carpenter
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: LiuJunyuan @ 2026-10-21  3:13 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, LiuJunyuan

Replace sprintf() with scnprintf() when formatting the resource name.

Signed-off-by: LiuJunyuan <2058432396@qq.com>
---
 drivers/staging/vme_user/vme_tsi148.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/vme_user/vme_tsi148.c b/drivers/staging/vme_user/vme_tsi148.c
index 9447c00bc013..a0a7c8341995 100644
--- a/drivers/staging/vme_user/vme_tsi148.c
+++ b/drivers/staging/vme_user/vme_tsi148.c
@@ -745,8 +745,8 @@ static int tsi148_alloc_resource(struct vme_master_resource *image,
 		}
 	}
 
-	sprintf((char *)image->bus_resource.name, "%s.%d", tsi148_bridge->name,
-		image->number);
+	scnprintf(image->bus_resource.name, VMENAMSIZ + 3, "%s.%d",
+		  tsi148_bridge->name, image->number);
 
 	image->bus_resource.start = 0;
 	image->bus_resource.end = (unsigned long)size;
-- 
2.43.0



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

* Re: [PATCH] staging: vme_user: use scnprintf in tsi148_alloc_resource
  2026-10-21  3:13 [PATCH] staging: vme_user: use scnprintf in tsi148_alloc_resource LiuJunyuan
@ 2026-10-21  6:01 ` Dan Carpenter
  2026-10-21  6:15 ` Greg KH
  2026-10-21  9:01 ` David Laight
  2 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2026-10-21  6:01 UTC (permalink / raw)
  To: LiuJunyuan; +Cc: gregkh, linux-staging, linux-kernel

On Wed, Oct 21, 2026 at 11:13:49AM +0800, LiuJunyuan wrote:
> Replace sprintf() with scnprintf() when formatting the resource name.
> 
> Signed-off-by: LiuJunyuan <2058432396@qq.com>

Is this a fix or a cleanup?

regards,
dan carpenter


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

* Re: [PATCH] staging: vme_user: use scnprintf in tsi148_alloc_resource
  2026-10-21  3:13 [PATCH] staging: vme_user: use scnprintf in tsi148_alloc_resource LiuJunyuan
  2026-10-21  6:01 ` Dan Carpenter
@ 2026-10-21  6:15 ` Greg KH
  2026-10-21  9:01 ` David Laight
  2 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2026-10-21  6:15 UTC (permalink / raw)
  To: LiuJunyuan; +Cc: linux-staging, linux-kernel

On Wed, Oct 21, 2026 at 11:13:49AM +0800, LiuJunyuan wrote:
> Replace sprintf() with scnprintf() when formatting the resource name.

Why?  That's a requirement for your changelog text.

thanks,

greg k-h

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

* Re: [PATCH] staging: vme_user: use scnprintf in tsi148_alloc_resource
  2026-10-21  3:13 [PATCH] staging: vme_user: use scnprintf in tsi148_alloc_resource LiuJunyuan
  2026-10-21  6:01 ` Dan Carpenter
  2026-10-21  6:15 ` Greg KH
@ 2026-10-21  9:01 ` David Laight
  2 siblings, 0 replies; 4+ messages in thread
From: David Laight @ 2026-10-21  9:01 UTC (permalink / raw)
  To: LiuJunyuan; +Cc: gregkh, linux-staging, linux-kernel

On Wed, 21 Oct 2026 11:13:49 +0800
LiuJunyuan <2058432396@qq.com> wrote:

> Replace sprintf() with scnprintf() when formatting the resource name.
> 
> Signed-off-by: LiuJunyuan <2058432396@qq.com>
> ---
>  drivers/staging/vme_user/vme_tsi148.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/vme_user/vme_tsi148.c b/drivers/staging/vme_user/vme_tsi148.c
> index 9447c00bc013..a0a7c8341995 100644
> --- a/drivers/staging/vme_user/vme_tsi148.c
> +++ b/drivers/staging/vme_user/vme_tsi148.c
> @@ -745,8 +745,8 @@ static int tsi148_alloc_resource(struct vme_master_resource *image,
>  		}
>  	}
>  
> -	sprintf((char *)image->bus_resource.name, "%s.%d", tsi148_bridge->name,
> -		image->number);
> +	scnprintf(image->bus_resource.name, VMENAMSIZ + 3, "%s.%d",

That looks like a very strange size...

David

> +		  tsi148_bridge->name, image->number);
>  
>  	image->bus_resource.start = 0;
>  	image->bus_resource.end = (unsigned long)size;


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

end of thread, other threads:[~2026-10-21  9:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-21  3:13 [PATCH] staging: vme_user: use scnprintf in tsi148_alloc_resource LiuJunyuan
2026-10-21  6:01 ` Dan Carpenter
2026-10-21  6:15 ` Greg KH
2026-10-21  9:01 ` David Laight

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

all inboxes | Powered by JetHome®