[U-Boot] [PATCH 1/1] vsprintf.c: add EFI device path printing

Wolfgang Denk wd at denx.de
Mon Nov 20 15:44:15 UTC 2017


Dear Heinrich,

In message <452bd166-5cc7-ff1d-925c-dc8b8e1bdbe5 at gmx.de> you wrote:
>
> >> +#ifdef CONFIG_EFI_LOADER
> >> +static char *device_path_string(char *buf, char *end, void *dp, int field_width,
> >> +				int precision, int flags)
> >> +{
> >> +	u16 *str = efi_dp_str((struct efi_device_path *)dp);
> >> +
> >> +	buf = string16(buf, end, str, field_width, precision, flags);
> >> +	efi_free_pool(str);
> > 
> > efi_dp_str() can return NULL. Should this not be handled?
> 
> Thanks for reviewing.
> 
> This situation is caught in string16:
> u16 *str = s ? s : L"<NULL>";

This is crash-preventing cosmetics, but no real error handling.  I
mean, should we not wave a big red flag and shout at the user: "Hey,
your system is going berserk here!" ?

> It can only occur if we are out of memory. All other error handling
> should be added to efi_convert_device_path_to_text().

Yes, and running out of memory at such a place is likely to be
unrecoverable. So we should terminate all further processing baed on
this result, and not continue with bogus data.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
All men should freely use those seven words which have the  power  to
make any marriage run smoothly: You know dear, you may be right.


More information about the U-Boot mailing list