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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-- 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@xxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux