From 78d0a593a5aa82f51f38792ce79b1d362fb05b14 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sun, 6 Jul 2008 16:24:57 -0700 Subject: [PATCH] --- yaml --- r: 98750 b: refs/heads/master c: 4d8a743cdd2690c0bc8d1b8cbd02cffb1ead849f h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/lib/vsprintf.c | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 14994f9d70d8..1cf4c6539961 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 78a8bf69b32980879975f7e31d30386c50bfe851 +refs/heads/master: 4d8a743cdd2690c0bc8d1b8cbd02cffb1ead849f diff --git a/trunk/lib/vsprintf.c b/trunk/lib/vsprintf.c index f569feb7662e..5d6f0718b6d9 100644 --- a/trunk/lib/vsprintf.c +++ b/trunk/lib/vsprintf.c @@ -511,7 +511,14 @@ static char *string(char *buf, char *end, char *s, int field_width, int precisio return buf; } -static char *pointer(char *buf, char *end, void *ptr, int field_width, int precision, int flags) +/* + * Show a '%p' thing. A kernel extension is that the '%p' is followed + * by an extra set of alphanumeric characters that are extended format + * specifiers. + * + * Right now don't actually handle any such, but we will.. + */ +static char *pointer(const char *fmt, char *buf, char *end, void *ptr, int field_width, int precision, int flags) { flags |= SMALL; if (field_width == -1) { @@ -663,7 +670,12 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) continue; case 'p': - str = pointer(str, end, va_arg(args, void *), field_width, precision, flags); + str = pointer(fmt+1, str, end, + va_arg(args, void *), + field_width, precision, flags); + /* Skip all alphanumeric pointer suffixes */ + while (isalnum(fmt[1])) + fmt++; continue; case 'n':