Commit 00fc398b authored by Anton Blanchard's avatar Anton Blanchard Committed by Linus Torvalds

[PATCH] ppc64: udbg should use snprintf

Use vsnprintf/snprintf in udbg.c
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 8dce5d70
...@@ -274,17 +274,15 @@ udbg_printSP(const char *s) ...@@ -274,17 +274,15 @@ udbg_printSP(const char *s)
} }
} }
void #define UDBG_BUFSIZE 256
udbg_printf(const char *fmt, ...) void udbg_printf(const char *fmt, ...)
{ {
unsigned char buf[256]; unsigned char buf[UDBG_BUFSIZE];
va_list args; va_list args;
va_start(args, fmt);
vsprintf(buf, fmt, args); va_start(args, fmt);
vsnprintf(buf, UDBG_BUFSIZE, fmt, args);
udbg_puts(buf); udbg_puts(buf);
va_end(args); va_end(args);
} }
...@@ -296,7 +294,7 @@ udbg_ppcdbg(unsigned long debug_flags, const char *fmt, ...) ...@@ -296,7 +294,7 @@ udbg_ppcdbg(unsigned long debug_flags, const char *fmt, ...)
if ( active_debugs ) { if ( active_debugs ) {
va_list ap; va_list ap;
unsigned char buf[256]; unsigned char buf[UDBG_BUFSIZE];
unsigned long i, len = 0; unsigned long i, len = 0;
for(i=0; i < PPCDBG_NUM_FLAGS ;i++) { for(i=0; i < PPCDBG_NUM_FLAGS ;i++) {
...@@ -307,7 +305,7 @@ udbg_ppcdbg(unsigned long debug_flags, const char *fmt, ...) ...@@ -307,7 +305,7 @@ udbg_ppcdbg(unsigned long debug_flags, const char *fmt, ...)
break; break;
} }
} }
sprintf(buf, " [%s]: ", current->comm); snprintf(buf, UDBG_BUFSIZE, " [%s]: ", current->comm);
len += strlen(buf); len += strlen(buf);
udbg_puts(buf); udbg_puts(buf);
...@@ -317,7 +315,7 @@ udbg_ppcdbg(unsigned long debug_flags, const char *fmt, ...) ...@@ -317,7 +315,7 @@ udbg_ppcdbg(unsigned long debug_flags, const char *fmt, ...)
} }
va_start(ap, fmt); va_start(ap, fmt);
vsprintf(buf, fmt, ap); vsnprintf(buf, UDBG_BUFSIZE, fmt, ap);
udbg_puts(buf); udbg_puts(buf);
va_end(ap); va_end(ap);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment