* [U-Boot] [PATCH v2] tiny-printf: Correct the snprintf() implementation
@ 2016-06-09 2:55 Simon Glass
2016-06-09 5:14 ` Stefan Roese
2016-06-09 18:02 ` Tom Rini
0 siblings, 2 replies; 4+ messages in thread
From: Simon Glass @ 2016-06-09 2:55 UTC (permalink / raw)
To: u-boot
This current code passes the variable arguments list to sprintf(). This is
not correct. Fix it by calling _vprintf() directly.
This makes firefly-rk3288 boot again.
Fixes: abeb272 ("tiny-printf: Support snprintf()")
Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v2:
- Correct the 'Fixes' line
lib/tiny-printf.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c
index 5ea2555..3c65fc9 100644
--- a/lib/tiny-printf.c
+++ b/lib/tiny-printf.c
@@ -168,8 +168,10 @@ int snprintf(char *buf, size_t size, const char *fmt, ...)
int ret;
va_start(va, fmt);
- ret = sprintf(buf, fmt, va);
+ outstr = buf;
+ ret = _vprintf(fmt, va, putc_outstr);
va_end(va);
+ *outstr = '\0';
return ret;
}
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH v2] tiny-printf: Correct the snprintf() implementation
2016-06-09 2:55 [U-Boot] [PATCH v2] tiny-printf: Correct the snprintf() implementation Simon Glass
@ 2016-06-09 5:14 ` Stefan Roese
2016-06-09 13:23 ` Marek Vasut
2016-06-09 18:02 ` Tom Rini
1 sibling, 1 reply; 4+ messages in thread
From: Stefan Roese @ 2016-06-09 5:14 UTC (permalink / raw)
To: u-boot
On 09.06.2016 04:55, Simon Glass wrote:
> This current code passes the variable arguments list to sprintf(). This is
> not correct. Fix it by calling _vprintf() directly.
>
> This makes firefly-rk3288 boot again.
>
> Fixes: abeb272 ("tiny-printf: Support snprintf()")
> Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Thanks,
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH v2] tiny-printf: Correct the snprintf() implementation
2016-06-09 5:14 ` Stefan Roese
@ 2016-06-09 13:23 ` Marek Vasut
0 siblings, 0 replies; 4+ messages in thread
From: Marek Vasut @ 2016-06-09 13:23 UTC (permalink / raw)
To: u-boot
On 06/09/2016 07:14 AM, Stefan Roese wrote:
> On 09.06.2016 04:55, Simon Glass wrote:
>> This current code passes the variable arguments list to sprintf().
>> This is
>> not correct. Fix it by calling _vprintf() directly.
>>
>> This makes firefly-rk3288 boot again.
>>
>> Fixes: abeb272 ("tiny-printf: Support snprintf()")
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>
> Reviewed-by: Stefan Roese <sr@denx.de>
Acked-by: Marek Vasut <marex@denx.de>
--
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH v2] tiny-printf: Correct the snprintf() implementation
2016-06-09 2:55 [U-Boot] [PATCH v2] tiny-printf: Correct the snprintf() implementation Simon Glass
2016-06-09 5:14 ` Stefan Roese
@ 2016-06-09 18:02 ` Tom Rini
1 sibling, 0 replies; 4+ messages in thread
From: Tom Rini @ 2016-06-09 18:02 UTC (permalink / raw)
To: u-boot
On Wed, Jun 08, 2016 at 08:55:15PM -0600, Simon Glass wrote:
> This current code passes the variable arguments list to sprintf(). This is
> not correct. Fix it by calling _vprintf() directly.
>
> This makes firefly-rk3288 boot again.
>
> Fixes: abeb272 ("tiny-printf: Support snprintf()")
> Reviewed-by: Stefan Roese <sr@denx.de>
> Acked-by: Marek Vasut <marex@denx.de>
> Signed-off-by: Simon Glass <sjg@chromium.org>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160609/80f56a2f/attachment.sig>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-06-09 18:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-09 2:55 [U-Boot] [PATCH v2] tiny-printf: Correct the snprintf() implementation Simon Glass
2016-06-09 5:14 ` Stefan Roese
2016-06-09 13:23 ` Marek Vasut
2016-06-09 18:02 ` Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox