All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: u-boot@lists.denx.de
Subject: [PATCH 3/8 v2] efi_loader: Add size checks to efi_create_indexed_name()
Date: Wed, 30 Dec 2020 23:23:03 +0200	[thread overview]
Message-ID: <X+zvt8A8gfthr3O+@enceladus> (raw)
In-Reply-To: <cfe1fbc0-44ef-13e5-b1a8-2f5be577ee56@gmx.de>

On Wed, Dec 30, 2020 at 07:34:38PM +0100, Heinrich Schuchardt wrote:
> On 12/30/20 4:07 PM, Ilias Apalodimas wrote:
> > Although the function description states the caller must provide a
> > sufficient buffer, it's better to have in function checks and ensure
> > the destination buffer can hold the intended variable name.
> > 
> > So let's add an extra argument with the buffer size and check that
> > before copying.
> > 
> > Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> > ---
> >   include/efi_loader.h        |  3 ++-
> >   lib/efi_loader/efi_string.c | 10 ++++++++--
> >   test/unicode_ut.c           |  2 +-
> >   3 files changed, 11 insertions(+), 4 deletions(-)
> > 
> > diff --git a/include/efi_loader.h b/include/efi_loader.h
> > index 3c68b85b68e9..af30dbafab77 100644
> > --- a/include/efi_loader.h
> > +++ b/include/efi_loader.h
> > @@ -810,7 +810,8 @@ bool efi_image_parse(void *efi, size_t len, struct efi_image_regions **regp,
> >   void efi_memcpy_runtime(void *dest, const void *src, size_t n);
> > 
> >   /* commonly used helper function */
> > -u16 *efi_create_indexed_name(u16 *buffer, const char *name, unsigned int index);
> > +u16 *efi_create_indexed_name(u16 *buffer, size_t buffer_size, const char *name,
> > +			     unsigned int index);
> > 
> >   #else /* CONFIG_IS_ENABLED(EFI_LOADER) */
> 
> Please, rebase upon origin/next.
> 
> With this patch U-Boot does not compile:
> 
> lib/efi_loader/efi_capsule.c: In function ?set_capsule_result?:
> lib/efi_loader/efi_capsule.c:76:43: error: passing argument 2 of
> ?efi_create_indexed_name? makes integer from pointer without a cast
> [-Werror=int-conversion]
>    76 |  efi_create_indexed_name(variable_name16, "Capsule", index);
>       |                                           ^~~~~~~~~
>       |                                           |
>       |                                           char *
> 
> You missed to update lib/efi_loader/efi_capsule.c as you series is based
> on origin/master.

Bah sorry!
I'll rebase this on top of master and send it as a seperate patchset.

Cheers
/Ilias

  reply	other threads:[~2020-12-30 21:23 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-30 15:07 [PATCH 0/8 v2] Change logic of EFI LoadFile2 protocol for initrd loading Ilias Apalodimas
2020-12-30 15:07 ` [PATCH 1/8 v2] efi_loader: Remove unused headers from efi_load_initrd.c Ilias Apalodimas
2020-12-30 18:21   ` Heinrich Schuchardt
2020-12-30 15:07 ` [PATCH 2/8 v2] efi_loader: Remove unconditional installation of file2 protocol for initrd Ilias Apalodimas
2020-12-30 18:15   ` Heinrich Schuchardt
2020-12-30 15:07 ` [PATCH 3/8 v2] efi_loader: Add size checks to efi_create_indexed_name() Ilias Apalodimas
2020-12-30 18:34   ` Heinrich Schuchardt
2020-12-30 21:23     ` Ilias Apalodimas [this message]
2020-12-30 15:07 ` [PATCH 4/8 v2] efi_loader: Introduce helper functions for EFI Ilias Apalodimas
2020-12-30 19:29   ` Heinrich Schuchardt
2020-12-30 21:21     ` Ilias Apalodimas
2020-12-30 15:07 ` [PATCH 5/8 v2] efi_loader: bootmgr: Use get_var from efi_helper file Ilias Apalodimas
2020-12-30 19:32   ` Heinrich Schuchardt
2020-12-30 15:07 ` [PATCH 6/8 v2] efi_loader: Replace config option with EFI variable for initrd loading Ilias Apalodimas
2020-12-30 19:38   ` Heinrich Schuchardt
2021-01-05  2:42   ` AKASHI Takahiro
2021-01-05  8:50     ` Ilias Apalodimas
2021-01-06 10:43       ` Ilias Apalodimas
2021-01-06 11:07         ` Heinrich Schuchardt
2021-01-06 12:53           ` Ilias Apalodimas
2020-12-30 15:07 ` [PATCH 7/8 v2] efi_selftest: Modify self-tests for initrd loading via Loadfile2 Ilias Apalodimas
2020-12-30 20:29   ` Heinrich Schuchardt
2020-12-30 15:07 ` [PATCH 8/8 v2] doc: uefi: Add instruction for initrd loading Ilias Apalodimas
2020-12-30 20:17   ` Heinrich Schuchardt
2020-12-30 20:44 ` [PATCH 0/8 v2] Change logic of EFI LoadFile2 protocol " Heinrich Schuchardt
2020-12-30 21:17   ` Ilias Apalodimas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=X+zvt8A8gfthr3O+@enceladus \
    --to=ilias.apalodimas@linaro.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.