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

Sascha Hauer sha at pengutronix.de
Mon Dec 13 14:19:50 PST 2021


On Thu, Dec 09, 2021 at 11:58:41AM +0100, Ahmad Fatoum wrote:
> -- 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(-)

Applied, thanks

Sascha

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

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list