aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/vsprintf.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index f569feb7662e..5d6f0718b6d9 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -511,7 +511,14 @@ static char *string(char *buf, char *end, char *s, int field_width, int precisio
511 return buf; 511 return buf;
512} 512}
513 513
514static char *pointer(char *buf, char *end, void *ptr, int field_width, int precision, int flags) 514/*
515 * Show a '%p' thing. A kernel extension is that the '%p' is followed
516 * by an extra set of alphanumeric characters that are extended format
517 * specifiers.
518 *
519 * Right now don't actually handle any such, but we will..
520 */
521static char *pointer(const char *fmt, char *buf, char *end, void *ptr, int field_width, int precision, int flags)
515{ 522{
516 flags |= SMALL; 523 flags |= SMALL;
517 if (field_width == -1) { 524 if (field_width == -1) {
@@ -663,7 +670,12 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
663 continue; 670 continue;
664 671
665 case 'p': 672 case 'p':
666 str = pointer(str, end, va_arg(args, void *), field_width, precision, flags); 673 str = pointer(fmt+1, str, end,
674 va_arg(args, void *),
675 field_width, precision, flags);
676 /* Skip all alphanumeric pointer suffixes */
677 while (isalnum(fmt[1]))
678 fmt++;
667 continue; 679 continue;
668 680
669 case 'n': 681 case 'n':