Commit ffbfed03 authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by Linus Torvalds

lib/vsprintf.c: consume 'p' in format_decode

It seems a little simpler to consume the p from a %p specifier in
format_decode, just as it is done for the surrounding %c, %s and %% cases.

While there, delete a redundant and misplaced comment.
Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 205bd3d2
...@@ -1604,8 +1604,7 @@ int format_decode(const char *fmt, struct printf_spec *spec) ...@@ -1604,8 +1604,7 @@ int format_decode(const char *fmt, struct printf_spec *spec)
case 'p': case 'p':
spec->type = FORMAT_TYPE_PTR; spec->type = FORMAT_TYPE_PTR;
return fmt - start; return ++fmt - start;
/* skip alnum */
case '%': case '%':
spec->type = FORMAT_TYPE_PERCENT_CHAR; spec->type = FORMAT_TYPE_PERCENT_CHAR;
...@@ -1794,7 +1793,7 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) ...@@ -1794,7 +1793,7 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
break; break;
case FORMAT_TYPE_PTR: case FORMAT_TYPE_PTR:
str = pointer(fmt+1, str, end, va_arg(args, void *), str = pointer(fmt, str, end, va_arg(args, void *),
spec); spec);
while (isalnum(*fmt)) while (isalnum(*fmt))
fmt++; fmt++;
...@@ -2232,7 +2231,7 @@ int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf) ...@@ -2232,7 +2231,7 @@ int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf)
} }
case FORMAT_TYPE_PTR: case FORMAT_TYPE_PTR:
str = pointer(fmt+1, str, end, get_arg(void *), spec); str = pointer(fmt, str, end, get_arg(void *), spec);
while (isalnum(*fmt)) while (isalnum(*fmt))
fmt++; fmt++;
break; break;
......
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