U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Vincent Stehlé" <vincent.stehle@arm.com>
To: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Tom Rini <trini@konsulko.com>,
	Sughosh Ganu <sughosh.ganu@arm.com>, Udit Kumar <u-kumar1@ti.com>,
	Marek Vasut <marek.vasut+renesas@mailbox.org>,
	u-boot@lists.u-boot-project.org
Subject: Re: [PATCH 2/2] efi_selftest: add minimal fmp test
Date: Fri, 2 Oct 2026 11:26:38 +0200	[thread overview]
Message-ID: <ar94zly0zywmoZn2@debian> (raw)
In-Reply-To: <79ac74ea-390e-409e-bfcf-033357832d71@gmx.de>

On Thu, Oct 01, 2026 at 03:55:10PM +0200, Heinrich Schuchardt wrote:
> On 9/22/26 16:58, Vincent Stehlé wrote:
> > Add a minimal test for the UEFI Firmware Management Protocol.
(..)
> > +	/* Determine buffer size */
> > +	img_info_size = 0;
> > +	ret = fmp->get_image_info(fmp, &img_info_size, NULL, NULL, NULL, NULL,
> > +				  NULL, NULL);
> > +	if (ret != EFI_BUFFER_TOO_SMALL) {
> > +		efi_st_error("GetImageInfo returned %u\n", (unsigned int)ret);
> > +		goto out;
> > +	}
> 
> This fails if the number of images is 0.
> 
> ERROR: GetImageInfo returned 2 (EFI_INVALID_PARAMETER)
> 
> +struct efi_fw_image fw_images[] = {
> +};
> +
> +struct efi_capsule_update_info update_info = {
> +       .dfu_string = NULL,
> +       .num_images = ARRAY_SIZE(fw_images),
> +       .images = fw_images,
> +};
> 
> This looks like a bug in efi_fill_image_desc_array((). Why does it return
> EFI_INVALID_PARAMETER if the number of images is 0?
> 
> We should just return *img_info_size = 0 and EFI_SUCCESS instead.
> 
> The test should return EFI_ST_SUCCESS in this case.

Hi Heinrich,

Thank you very much for reviewing.

I confirm that I could reproduce this corner case with your changes.

In the end I think the test (v2) itself is fine, as it does pass when I
replace the calls to get_image_info() by the following code:

+       img_info = NULL;
+       desc_ver = EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION;
+       desc_cnt = 0;
+       desc_size = sizeof(struct efi_firmware_image_descriptor);
+       pkg_ver = 0;
+       pkg_ver_name = NULL;

I will try to send a fix for efi_fill_image_desc_array() as you
mentioned, but if you agree that will be separated from this series.

Best regards,
Vincent.

> 
> Best regards
> 
> Heinrich

  reply	other threads:[~2026-10-02  9:26 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22 14:58 [PATCH 0/2] efi: fix and test FMP image info authentication attribute Vincent Stehlé
2026-09-22 14:58 ` [PATCH 1/2] efi_loader: fix " Vincent Stehlé
2026-10-01  1:31   ` Simon Glass
2026-10-01 12:37   ` Ilias Apalodimas
2026-09-22 14:58 ` [PATCH 2/2] efi_selftest: add minimal fmp test Vincent Stehlé
2026-10-01  1:31   ` Simon Glass
2026-10-01 15:46     ` Vincent Stehlé
2026-10-01 13:55   ` Heinrich Schuchardt
2026-10-02  9:26     ` Vincent Stehlé [this message]
2026-10-02 14:39       ` Heinrich Schuchardt
2026-10-02  8:37 ` [PATCH v2 0/2] efi: fix and test FMP image info authentication attribute Vincent Stehlé
2026-10-02  8:37   ` [PATCH v2 1/2] efi_loader: fix " Vincent Stehlé
2026-10-03  5:39     ` Simon Glass
2026-10-08 10:33     ` Ilias Apalodimas
2026-10-02  8:37   ` [PATCH v2 2/2] efi_selftest: add minimal fmp test Vincent Stehlé
2026-10-03  5:40     ` Simon Glass
2026-10-03 15:23       ` Tom Rini

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=ar94zly0zywmoZn2@debian \
    --to=vincent.stehle@arm.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=marek.vasut+renesas@mailbox.org \
    --cc=sughosh.ganu@arm.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.u-boot-project.org \
    --cc=u-kumar1@ti.com \
    --cc=xypron.glpk@gmx.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox