diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 98ad170b10e0d0eebedadc4e05620f110f58213c..cf12ba86205c096eea6543e3c2850e384ca139c1 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -1727,7 +1727,7 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) /* Reject out-of-range values early. Large positive sizes are used for unknown buffer sizes. */ - if (WARN_ON_ONCE((int) size < 0)) + if (WARN_ON_ONCE(size > INT_MAX)) return 0; str = buf;