From: Jan Beulich Date: Wed, 25 May 2011 00:13:18 +0000 (-0700) Subject: lib/vsprintf.c: fix interaction of kasprintf() and vsnprintf() when using %pV X-Git-Tag: MMI-PSA29.97-13-9~19505 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d9be9b90d6dc5e712ca5d6109691a8de753ce7f1;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git lib/vsprintf.c: fix interaction of kasprintf() and vsnprintf() when using %pV Otherwise, the warning at the top of vsnprintf() gets triggered by kvasprintf()'s first invocation (with NULL buffer and zero size) of vsnprintf(). Signed-off-by: Jan Beulich Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 1d659d7bb0f8..c11205688fb4 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -898,7 +898,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, case 'U': return uuid_string(buf, end, ptr, spec, fmt); case 'V': - return buf + vsnprintf(buf, end - buf, + return buf + vsnprintf(buf, end > buf ? end - buf : 0, ((struct va_format *)ptr)->fmt, *(((struct va_format *)ptr)->va)); case 'K':