Message ID | 20220208000532.1054311-2-longman@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | mm/page_owner: Extend page_owner to show memcg information | expand |
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 3b8129dd374c..d419154b47bb 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -2895,13 +2895,15 @@ int vscnprintf(char *buf, size_t size, const char *fmt, va_list args) { int i; + if (unlikely(!size)) + return 0; + i = vsnprintf(buf, size, fmt, args); if (likely(i < size)) return i; - if (size != 0) - return size - 1; - return 0; + + return size - 1; } EXPORT_SYMBOL(vscnprintf);