[PATCH v3 11/19] bootmeth_efi: Check the filename-allocation in the network path
Simon Glass
sjg at chromium.org
Sat Nov 16 00:19:08 CET 2024
Hi Heinrich,
On Mon, 4 Nov 2024 at 14:42, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> On 11/4/24 18:51, Simon Glass wrote:
> > If the filename cannot be set we should give up. Add the missing error
> > check.
> >
> > Signed-off-by: Simon Glass <sjg at chromium.org>
> > ---
> >
> > (no changes since v2)
> >
> > Changes in v2:
> > - Change the tag to bootmeth_efi
> >
> > boot/bootmeth_efi.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/boot/bootmeth_efi.c b/boot/bootmeth_efi.c
> > index e8109e19bcb..1ff8788ebeb 100644
> > --- a/boot/bootmeth_efi.c
> > +++ b/boot/bootmeth_efi.c
> > @@ -269,6 +269,8 @@ static int distro_efi_read_bootflow_net(struct bootflow *bflow)
> > if (!bootfile_name)
> > return log_msg_ret("bootfile_name", ret);
> > bflow->fname = strdup(bootfile_name);
> > + if (!bflow->fname)
> > + return log_msg_ret("fi0", -ENOMEM);
>
> How could we hope that a user understands a cryptic message
> "fi0: returning err=-12"?
>
> Please, write a message that is user readable.
>
> log_err("Out of memory");
We cannot write to the screen here as it is in a driver. The log
message only appear if debugging is enabled and
CONFIG_LOG_ERROR_RETURN as well.
They are aimed at being enough for someone to grep the code, without
adding so much to the string space that U-Boot grows to Tianocore
dimensions.
[..]
Regards,
Simon
More information about the U-Boot
mailing list