All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: plat-samsung: using vsnprintf instead of vsprintf for the limit buffer length 256
@ 2013-01-21 10:25 ` Chen Gang
  0 siblings, 0 replies; 10+ messages in thread
From: Chen Gang @ 2013-01-21 10:25 UTC (permalink / raw)
  To: kgene.kim, ben-linux, linux; +Cc: linux-arm-kernel, linux-samsung-soc


  the buff size is 256, so need use vsnprintf instead of vsprintf.

Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
 arch/arm/plat-samsung/pm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/plat-samsung/pm.c b/arch/arm/plat-samsung/pm.c
index 1507028..8d07b45 100644
--- a/arch/arm/plat-samsung/pm.c
+++ b/arch/arm/plat-samsung/pm.c
@@ -51,7 +51,7 @@ void s3c_pm_dbg(const char *fmt, ...)
 	char buff[256];
 
 	va_start(va, fmt);
-	vsprintf(buff, fmt, va);
+	vsnprintf(buff, 256, fmt, va);
 	va_end(va);
 
 	printascii(buff);
-- 
1.7.10.4

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

* [PATCH] ARM: plat-samsung: using vsnprintf instead of vsprintf for the limit buffer length 256
@ 2013-01-21 10:25 ` Chen Gang
  0 siblings, 0 replies; 10+ messages in thread
From: Chen Gang @ 2013-01-21 10:25 UTC (permalink / raw)
  To: linux-arm-kernel


  the buff size is 256, so need use vsnprintf instead of vsprintf.

Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
 arch/arm/plat-samsung/pm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/plat-samsung/pm.c b/arch/arm/plat-samsung/pm.c
index 1507028..8d07b45 100644
--- a/arch/arm/plat-samsung/pm.c
+++ b/arch/arm/plat-samsung/pm.c
@@ -51,7 +51,7 @@ void s3c_pm_dbg(const char *fmt, ...)
 	char buff[256];
 
 	va_start(va, fmt);
-	vsprintf(buff, fmt, va);
+	vsnprintf(buff, 256, fmt, va);
 	va_end(va);
 
 	printascii(buff);
-- 
1.7.10.4

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

* Re: [PATCH] ARM: plat-samsung: using vsnprintf instead of vsprintf for the limit buffer length 256
  2013-01-21 10:25 ` Chen Gang
@ 2013-01-21 13:56   ` Ben Dooks
  -1 siblings, 0 replies; 10+ messages in thread
From: Ben Dooks @ 2013-01-21 13:56 UTC (permalink / raw)
  To: Chen Gang
  Cc: linux-samsung-soc, kgene.kim, linux, linux-arm-kernel, ben-linux

On Mon, Jan 21, 2013 at 06:25:18PM +0800, Chen Gang wrote:
> 
>   the buff size is 256, so need use vsnprintf instead of vsprintf.
> 
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> ---
>  arch/arm/plat-samsung/pm.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/plat-samsung/pm.c b/arch/arm/plat-samsung/pm.c
> index 1507028..8d07b45 100644
> --- a/arch/arm/plat-samsung/pm.c
> +++ b/arch/arm/plat-samsung/pm.c
> @@ -51,7 +51,7 @@ void s3c_pm_dbg(const char *fmt, ...)
>  	char buff[256];
>  
>  	va_start(va, fmt);
> -	vsprintf(buff, fmt, va);
> +	vsnprintf(buff, 256, fmt, va);

How about: vsnprintf(buff, sizeof(buff), fmt, va);

It means we do not end up assuming the size of 'buff' and will be correct
if the code is changed to declare 'buff' to be a different size.

-- 
Ben Dooks, ben@fluff.org, http://www.fluff.org/ben/

Large Hadron Colada: A large Pina Colada that makes the universe disappear.

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

* [PATCH] ARM: plat-samsung: using vsnprintf instead of vsprintf for the limit buffer length 256
@ 2013-01-21 13:56   ` Ben Dooks
  0 siblings, 0 replies; 10+ messages in thread
From: Ben Dooks @ 2013-01-21 13:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jan 21, 2013 at 06:25:18PM +0800, Chen Gang wrote:
> 
>   the buff size is 256, so need use vsnprintf instead of vsprintf.
> 
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> ---
>  arch/arm/plat-samsung/pm.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/plat-samsung/pm.c b/arch/arm/plat-samsung/pm.c
> index 1507028..8d07b45 100644
> --- a/arch/arm/plat-samsung/pm.c
> +++ b/arch/arm/plat-samsung/pm.c
> @@ -51,7 +51,7 @@ void s3c_pm_dbg(const char *fmt, ...)
>  	char buff[256];
>  
>  	va_start(va, fmt);
> -	vsprintf(buff, fmt, va);
> +	vsnprintf(buff, 256, fmt, va);

How about: vsnprintf(buff, sizeof(buff), fmt, va);

It means we do not end up assuming the size of 'buff' and will be correct
if the code is changed to declare 'buff' to be a different size.

-- 
Ben Dooks, ben at fluff.org, http://www.fluff.org/ben/

Large Hadron Colada: A large Pina Colada that makes the universe disappear.

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

* Re: [PATCH] ARM: plat-samsung: using vsnprintf instead of vsprintf for the limit buffer length 256
  2013-01-21 10:25 ` Chen Gang
@ 2013-01-21 16:00   ` Russell King - ARM Linux
  -1 siblings, 0 replies; 10+ messages in thread
From: Russell King - ARM Linux @ 2013-01-21 16:00 UTC (permalink / raw)
  To: Chen Gang; +Cc: kgene.kim, ben-linux, linux-arm-kernel, linux-samsung-soc

On Mon, Jan 21, 2013 at 06:25:18PM +0800, Chen Gang wrote:
> 
>   the buff size is 256, so need use vsnprintf instead of vsprintf.
> 
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> ---
>  arch/arm/plat-samsung/pm.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/plat-samsung/pm.c b/arch/arm/plat-samsung/pm.c
> index 1507028..8d07b45 100644
> --- a/arch/arm/plat-samsung/pm.c
> +++ b/arch/arm/plat-samsung/pm.c
> @@ -51,7 +51,7 @@ void s3c_pm_dbg(const char *fmt, ...)
>  	char buff[256];
>  
>  	va_start(va, fmt);
> -	vsprintf(buff, fmt, va);
> +	vsnprintf(buff, 256, fmt, va);

sizeof(buff) would be better here so that it depends on the actual buffer
size.

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

* [PATCH] ARM: plat-samsung: using vsnprintf instead of vsprintf for the limit buffer length 256
@ 2013-01-21 16:00   ` Russell King - ARM Linux
  0 siblings, 0 replies; 10+ messages in thread
From: Russell King - ARM Linux @ 2013-01-21 16:00 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jan 21, 2013 at 06:25:18PM +0800, Chen Gang wrote:
> 
>   the buff size is 256, so need use vsnprintf instead of vsprintf.
> 
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> ---
>  arch/arm/plat-samsung/pm.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/plat-samsung/pm.c b/arch/arm/plat-samsung/pm.c
> index 1507028..8d07b45 100644
> --- a/arch/arm/plat-samsung/pm.c
> +++ b/arch/arm/plat-samsung/pm.c
> @@ -51,7 +51,7 @@ void s3c_pm_dbg(const char *fmt, ...)
>  	char buff[256];
>  
>  	va_start(va, fmt);
> -	vsprintf(buff, fmt, va);
> +	vsnprintf(buff, 256, fmt, va);

sizeof(buff) would be better here so that it depends on the actual buffer
size.

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

* Re: [PATCH] ARM: plat-samsung: using vsnprintf instead of vsprintf for the limit buffer length 256
  2013-01-21 13:56   ` Ben Dooks
@ 2013-01-22  1:00     ` Chen Gang
  -1 siblings, 0 replies; 10+ messages in thread
From: Chen Gang @ 2013-01-22  1:00 UTC (permalink / raw)
  To: Ben Dooks
  Cc: kgene.kim, ben-linux, linux, linux-arm-kernel, linux-samsung-soc

于 2013年01月21日 21:56, Ben Dooks 写道:
> How about: vsnprintf(buff, sizeof(buff), fmt, va);
> 
> It means we do not end up assuming the size of 'buff' and will be correct
> if the code is changed to declare 'buff' to be a different size.

  thank you, I will send patch v2.

  :-)

-- 
Chen Gang

Asianux Corporation

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

* [PATCH] ARM: plat-samsung: using vsnprintf instead of vsprintf for the limit buffer length 256
@ 2013-01-22  1:00     ` Chen Gang
  0 siblings, 0 replies; 10+ messages in thread
From: Chen Gang @ 2013-01-22  1:00 UTC (permalink / raw)
  To: linux-arm-kernel

? 2013?01?21? 21:56, Ben Dooks ??:
> How about: vsnprintf(buff, sizeof(buff), fmt, va);
> 
> It means we do not end up assuming the size of 'buff' and will be correct
> if the code is changed to declare 'buff' to be a different size.

  thank you, I will send patch v2.

  :-)

-- 
Chen Gang

Asianux Corporation

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

* Re: [PATCH] ARM: plat-samsung: using vsnprintf instead of vsprintf for the limit buffer length 256
  2013-01-21 16:00   ` Russell King - ARM Linux
@ 2013-01-22  1:00     ` Chen Gang
  -1 siblings, 0 replies; 10+ messages in thread
From: Chen Gang @ 2013-01-22  1:00 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: kgene.kim, ben-linux, linux-arm-kernel, linux-samsung-soc

于 2013年01月22日 00:00, Russell King - ARM Linux 写道:
> sizeof(buff) would be better here so that it depends on the actual buffer
> size.

  thank you, I will send patch v2.

  :-)

-- 
Chen Gang

Asianux Corporation

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

* [PATCH] ARM: plat-samsung: using vsnprintf instead of vsprintf for the limit buffer length 256
@ 2013-01-22  1:00     ` Chen Gang
  0 siblings, 0 replies; 10+ messages in thread
From: Chen Gang @ 2013-01-22  1:00 UTC (permalink / raw)
  To: linux-arm-kernel

? 2013?01?22? 00:00, Russell King - ARM Linux ??:
> sizeof(buff) would be better here so that it depends on the actual buffer
> size.

  thank you, I will send patch v2.

  :-)

-- 
Chen Gang

Asianux Corporation

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

end of thread, other threads:[~2013-01-22  1:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-21 10:25 [PATCH] ARM: plat-samsung: using vsnprintf instead of vsprintf for the limit buffer length 256 Chen Gang
2013-01-21 10:25 ` Chen Gang
2013-01-21 13:56 ` Ben Dooks
2013-01-21 13:56   ` Ben Dooks
2013-01-22  1:00   ` Chen Gang
2013-01-22  1:00     ` Chen Gang
2013-01-21 16:00 ` Russell King - ARM Linux
2013-01-21 16:00   ` Russell King - ARM Linux
2013-01-22  1:00   ` Chen Gang
2013-01-22  1:00     ` Chen Gang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.