[U-Boot] [PATCH 04/10] tiny-printf: Avoid printing NULL strings

Simon Glass sjg at chromium.org
Sat Jan 16 02:25:42 CET 2016


On 29 December 2015 at 06:23, Stefan Roese <sr at denx.de> wrote:
> On 29.12.2015 13:22, Simon Glass wrote:
>>
>> Add a check for NULL strings to avoid printing junk to the console.
>>
>> Signed-off-by: Simon Glass <sjg at chromium.org>
>> ---
>>
>>   lib/tiny-printf.c | 6 ++++--
>>   1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c
>> index 403b134..efe5c25 100644
>> --- a/lib/tiny-printf.c
>> +++ b/lib/tiny-printf.c
>> @@ -108,8 +108,10 @@ int vprintf(const char *fmt, va_list va)
>>                                 w--;
>>                         while (w-- > 0)
>>                                 putc(lz ? '0' : ' ');
>> -                       while ((ch = *p++))
>> -                               putc(ch);
>> +                       if (p) {
>> +                               while ((ch = *p++))
>> +                                       putc(ch);
>> +                       }
>>                 }
>>         }
>>
>>
>
> Reviewed-by: Stefan Roese <sr at denx.de>

Applied to u-boot-dm


More information about the U-Boot mailing list