[PATCH] fixup! vsprintf: add optional support for %ls format modifier

Ahmad Fatoum a.fatoum at pengutronix.de
Thu Dec 9 02:58:41 PST 2021


-- has higher operator precedence than *, so instead of decreasing
field_width, the pointer was decremented. This lead to misalignment,
e.g. when doing of_dump. Fix this up.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 lib/vsprintf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index ce92787c58ef..9a94a1bbe84e 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -153,7 +153,7 @@ static char *leading_spaces(char *buf, const char *end,
 			    int len, int *field_width, int flags)
 {
 	if (!(flags & LEFT)) {
-		while (len < *field_width--) {
+		while (len < (*field_width)--) {
 			if (buf < end)
 				*buf = ' ';
 			++buf;
@@ -166,7 +166,7 @@ static char *leading_spaces(char *buf, const char *end,
 static char *trailing_spaces(char *buf, const char *end,
 			     int len, int *field_width, int flags)
 {
-	while (len < *field_width--) {
+	while (len < (*field_width)--) {
 		if (buf < end)
 			*buf = ' ';
 		++buf;
-- 
2.30.2




More information about the barebox mailing list