mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] fixup! vsprintf: add optional support for %ls format modifier
@ 2021-12-09 10:58 Ahmad Fatoum
  2021-12-13 22:19 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2021-12-09 10:58 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

-- 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@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-13 22:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-09 10:58 [PATCH] fixup! vsprintf: add optional support for %ls format modifier Ahmad Fatoum
2021-12-13 22:19 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox