mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] fixup! vsprintf: add optional support for %ls format modifier
Date: Thu,  9 Dec 2021 11:58:41 +0100	[thread overview]
Message-ID: <20211209105841.3518522-1-a.fatoum@pengutronix.de> (raw)

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


             reply	other threads:[~2021-12-09 11:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-09 10:58 Ahmad Fatoum [this message]
2021-12-13 22:19 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211209105841.3518522-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox