diff options
author | Arvind Sankar <nivedita@alum.mit.edu> | 2020-05-18 15:07:01 -0400 |
---|---|---|
committer | Ard Biesheuvel <ardb@kernel.org> | 2020-05-19 10:31:25 +0200 |
commit | 77e48db04a02ebd00229281c26575979b0b465e0 (patch) | |
tree | 9fddf25380dca5ef93e6c7c249b0bb6a56ca2f17 /drivers/firmware/efi/libstub | |
parent | 3b8350959cba0df4070741618e50c367319793bb (diff) |
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 <nivedita@alum.mit.edu>
Link: https://lore.kernel.org/r/20200518190716.751506-10-nivedita@alum.mit.edu
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'drivers/firmware/efi/libstub')
-rw-r--r-- | drivers/firmware/efi/libstub/vsprintf.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/firmware/efi/libstub/vsprintf.c b/drivers/firmware/efi/libstub/vsprintf.c index fb9eb83f1728..00123d5f402f 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 */ |