ARM: plat-samsung: using vsnprintf instead of vsprintf for the limit buffer length 256
Subsystems (3)
PATCH 1/1 ARM: plat-samsung: using vsnprintf instead of vsprintf for the limit buffer length 256
the buff size is 256, so need use vsnprintf instead of vsprintf.
--- arch/arm/plat-samsung/pm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/plat-samsung/pm.c +1 -1
@@ -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);
Signature · 1 line
1.7.10.4
PATCH 1/1 ARM: plat-samsung: using vsnprintf instead of vsprintf for the limit buffer length 256
Quoted 13 lines · Chen Gang
the buff size is 256, so need use vsnprintf instead of vsprintf.
Signed-off-by Chen Gang <[email protected]>--- arch/arm/plat-samsung/pm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/plat-samsung/pm.c +0
-0
arch/arm/plat-samsung/pm.c void s3c_pm_dbg(const char *fmt, ...) · line 54
Quoted 5 lines
arch/arm/plat-samsung/pm.c +1
-1@@ -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.
Signature · 3 lines
Ben Dooks, ben at fluff.org, http://www.fluff.org/ben/ Large Hadron Colada: A large Pina Colada that makes the universe disappear.
PATCH 1/1 ARM: plat-samsung: using vsnprintf instead of vsprintf for the limit buffer length 256
In reply to Chen GangQuoted 13 lines · Chen Gang
the buff size is 256, so need use vsnprintf instead of vsprintf.
Signed-off-by Chen Gang <[email protected]>--- arch/arm/plat-samsung/pm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/plat-samsung/pm.c +0
-0
arch/arm/plat-samsung/pm.c void s3c_pm_dbg(const char *fmt, ...) · line 54
Quoted 5 lines
arch/arm/plat-samsung/pm.c +1
-1@@ -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.
PATCH 1/1 ARM: plat-samsung: using vsnprintf instead of vsprintf for the limit buffer length 256
In reply to Ben DooksQuoted 4 lines · 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.
:-)
Signature · 3 lines
Chen Gang Asianux Corporation
PATCH 1/1 ARM: plat-samsung: using vsnprintf instead of vsprintf for the limit buffer length 256
In reply to Russell King - ARM LinuxQuoted 2 lines · 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.
:-)
Signature · 3 lines
Chen Gang Asianux Corporation