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 2/6] efi_loader: Add device path related functions for initrd via Boot####
Date: Sun, 14 Mar 2021 09:32:00 +0200	[thread overview]
Message-ID: <YE278DOFJE8NM2up@enceladus> (raw)
In-Reply-To: <fe840c81-b453-5118-ad69-a9e44e2b52d9@gmx.de>

On Sun, Mar 14, 2021 at 08:19:49AM +0100, Heinrich Schuchardt wrote:
> > + *               Caller must free the returned value

[...]

> > + */
> > +struct
> > +efi_device_path *efi_dp_from_lo(struct efi_load_option *lo,
> > +				efi_uintn_t *size, efi_guid_t guid)
> > +{
> > +	struct efi_device_path *fp = lo->file_path;
> > +	struct efi_device_path_vendor *vendor;
> > +	int lo_len = lo->file_path_length;
> > +
> > +	for (; lo_len >=  sizeof(struct efi_device_path);
> > +	     lo_len -= fp->length, fp = (void *)fp + fp->length) {
> > +		if (fp->type != DEVICE_PATH_TYPE_MEDIA_DEVICE ||
> > +		    fp->sub_type != DEVICE_PATH_SUB_TYPE_VENDOR_PATH)
> > +			continue;
> 
> The device path is provided by the user and may be constructed incorrectly.
> 
> lo_len might be negative here. Or the remaining device path might not
> fit into lo_len.
> 
> Function efi_dp_check_length() can be used to check the size but it
> currently accepts only positive values of maxlen. Maybe we should change
> the type of maxlen to ssize() in that function.
> 

Yea, I forgot to fix this one. 

Regards
/Ilias
> Best regards
> 
> Heinrich
> 
> > +
> > +		vendor = (struct efi_device_path_vendor *)fp;
> > +		if (!guidcmp(&vendor->guid, &guid))
> > +			return efi_dp_dup(fp);
> > +	}
> > +	log_debug("VenMedia(%pUl) not found in %ls\n", &guid, lo->label);
> > +
> > +	return NULL;
> > +}
> > 
> 

  reply	other threads:[~2021-03-14  7:32 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-13 21:47 [PATCH 0/6 v2] Loadfile2 for initrd loading Ilias Apalodimas
2021-03-13 21:47 ` [PATCH 1/6 v2] efi_selftest: Remove loadfile2 for initrd selftests Ilias Apalodimas
2021-03-13 21:47 ` [PATCH 2/6] efi_loader: Add device path related functions for initrd via Boot#### Ilias Apalodimas
2021-03-14  7:19   ` Heinrich Schuchardt
2021-03-14  7:32     ` Ilias Apalodimas [this message]
2021-03-13 21:47 ` [PATCH 3/6 v2] efi_loader: Introduce helper functions for EFI Ilias Apalodimas
2021-03-14  7:31   ` Heinrich Schuchardt
2021-03-14  7:34     ` Ilias Apalodimas
2021-03-14  8:01       ` Heinrich Schuchardt
2021-03-14  8:07         ` Ilias Apalodimas
2021-03-14  8:49   ` Heinrich Schuchardt
2021-03-14  9:24   ` Heinrich Schuchardt
2021-03-13 21:47 ` [PATCH 4/6 v2] efi_loader: Replace config option for initrd loading Ilias Apalodimas
2021-03-14  9:54   ` Heinrich Schuchardt
2021-03-14 10:08   ` Heinrich Schuchardt
2021-03-14 10:19   ` Heinrich Schuchardt
2021-03-13 21:47 ` [PATCH 5/6 v2] efidebug: add multiple device path instances on Boot#### Ilias Apalodimas
2021-03-14  9:27   ` Heinrich Schuchardt
2021-03-14  9:42     ` Heinrich Schuchardt
2021-03-14  9:44       ` Ilias Apalodimas
2021-03-14 10:14   ` Heinrich Schuchardt
2021-03-13 21:47 ` [PATCH 6/6 v2] doc: Update uefi documentation for initrd loading options Ilias Apalodimas
2021-03-14  7:53   ` Heinrich Schuchardt
2021-03-14  9:02     ` Ilias Apalodimas
2021-03-14  8:41 ` [PATCH 0/6 v2] Loadfile2 for initrd loading Heinrich Schuchardt
  -- strict thread matches above, loose matches on Subject: below --
2021-03-05 22:22 [PATCH 1/6] efi_selftest: Remove loadfile2 for initrd selftests Ilias Apalodimas
2021-03-05 22:22 ` [PATCH 2/6] efi_loader: Add device path related functions for initrd via Boot#### Ilias Apalodimas
2021-03-11  7:50   ` Heinrich Schuchardt
2021-03-11  9:10     ` Ilias Apalodimas
2021-03-11 11:00       ` Heinrich Schuchardt
2021-03-11 11:36         ` Ilias Apalodimas
2021-03-11 11:44           ` Heinrich Schuchardt
2021-03-11 12:31             ` Heinrich Schuchardt
2021-03-11 12:39               ` Ilias Apalodimas
2021-03-11 12:44                 ` Heinrich Schuchardt
2021-03-11 12:49                   ` Ilias Apalodimas
2021-03-11 13:31             ` Ilias Apalodimas
2021-03-11 20:25               ` Heinrich Schuchardt
2021-03-12  2:50           ` AKASHI Takahiro
2021-03-12  4:10             ` Ilias Apalodimas
2021-03-12  4:32               ` AKASHI Takahiro
2021-03-12  4:42                 ` Ilias Apalodimas
2021-03-12  5:02                   ` AKASHI Takahiro
2021-03-12  5:19                     ` 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=YE278DOFJE8NM2up@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.