diff mbox series

[09/24] efi/printf: Fix minor bug in precision handling

Message ID 20200518190716.751506-10-nivedita@alum.mit.edu
State New
Headers show
Series [01/24] efi/libstub: Include dependencies of efistub.h | expand

Commit Message

Arvind Sankar May 18, 2020, 7:07 p.m. UTC
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>
---
 drivers/firmware/efi/libstub/vsprintf.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/firmware/efi/libstub/vsprintf.c b/drivers/firmware/efi/libstub/vsprintf.c
index b3ed4af77af5..d7938e44f067 100644
--- a/drivers/firmware/efi/libstub/vsprintf.c
+++ b/drivers/firmware/efi/libstub/vsprintf.c
@@ -278,9 +278,10 @@  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 */