From: Arvind Sankar Date: Mon, 18 May 2020 19:07:01 +0000 (-0400) Subject: efi/printf: Fix minor bug in precision handling X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=77e48db04a02ebd00229281c26575979b0b465e0;p=linux.git efi/printf: Fix minor bug in precision handling A negative precision should be ignored completely, and the presence of a valid precision should turn off the 0 flag. Signed-off-by: Arvind Sankar Link: https://lore.kernel.org/r/20200518190716.751506-10-nivedita@alum.mit.edu Signed-off-by: Ard Biesheuvel --- diff --git a/drivers/firmware/efi/libstub/vsprintf.c b/drivers/firmware/efi/libstub/vsprintf.c index fb9eb83f1728d..00123d5f402f6 100644 --- a/drivers/firmware/efi/libstub/vsprintf.c +++ b/drivers/firmware/efi/libstub/vsprintf.c @@ -279,9 +279,11 @@ int vsprintf(char *buf, const char *fmt, va_list args) ++fmt; /* it's the next argument */ precision = va_arg(args, int); - } - if (precision < 0) + } else { precision = 0; + } + if (precision >= 0) + flags &= ~ZEROPAD; } /* get the conversion qualifier */