Skip to content

Commit 77e48db

Browse files
nivedita76ardbiesheuvel
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ard Biesheuvel <[email protected]>
1 parent 3b83509 commit 77e48db

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/firmware/efi/libstub/vsprintf.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,11 @@ int vsprintf(char *buf, const char *fmt, va_list args)
279279
++fmt;
280280
/* it's the next argument */
281281
precision = va_arg(args, int);
282-
}
283-
if (precision < 0)
282+
} else {
284283
precision = 0;
284+
}
285+
if (precision >= 0)
286+
flags &= ~ZEROPAD;
285287
}
286288

287289
/* get the conversion qualifier */

0 commit comments

Comments
 (0)