public inbox for u-boot@lists.denx.de
 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>,
	u-boot@lists.denx.de,
	AKASHI Takahiro <takahiro.akashi@linaro.org>
Subject: Re: [PATCH 2/2] efi_selftest: add hii database protocol test case
Date: Thu, 5 Jan 2023 15:48:25 +0100	[thread overview]
Message-ID: <Y7bjOU2nVlGdxn98@debian> (raw)
In-Reply-To: <6422b676-877e-ebb8-953e-d653428c6be4@gmx.de>

On Thu, Dec 22, 2022 at 10:45:22AM +0100, Heinrich Schuchardt wrote:

Hi Heinrich,

Happy new year, and thank you for the reviews.
More comments below.

> On 12/13/22 22:39, Vincent Stehlé wrote:
> > Add a test for the case when the HII database protocol
> > get_package_list_handle() function is called with an invalid package list
> > handle.
> > 
> > Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
> > Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
> > Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> > ---
> >   lib/efi_selftest/efi_selftest_hii.c | 10 ++++++++++
> >   1 file changed, 10 insertions(+)
> > 
> > diff --git a/lib/efi_selftest/efi_selftest_hii.c b/lib/efi_selftest/efi_selftest_hii.c
> > index eaf3b0995d4..8a038d9f534 100644
> > --- a/lib/efi_selftest/efi_selftest_hii.c
> > +++ b/lib/efi_selftest/efi_selftest_hii.c
> > @@ -605,6 +605,16 @@ static int test_hii_database_get_package_list_handle(void)
> >   		goto out;
> >   	}
> > 
> > +	/* Invalid package list handle. */
> > +	driver_handle = NULL;
> > +	ret = hii_database_protocol->get_package_list_handle(
> > +			hii_database_protocol, NULL, &driver_handle);
> > +	if (ret != EFI_INVALID_PARAMETER) {
> 
> Here it is unclear, if you get EFI_INVALID_PARAMETER because the
> PackageListHandle is invalid or DriverHandle is NULL.

In principle, the value used to initialize the (output) parameter driver_handle
should not affect the test. Also, we are initializing driver_handle in exactly
the same way as was done in the previous test, which we know succeeded.

Anyway, if you think it makes the test more readable I can change the
initialization to something like the following:

  driver_handle = (efi_handle_t)0x23456789; /* dummy */

> 
> We should test both cases separately.

Would you prefer something like the following couple of tests?

  /* Invalid package list handle. */
  driver_handle = (efi_handle_t)0x23456789; /* dummy */
  ret = hii_database_protocol->get_package_list_handle(
                  hii_database_protocol, NULL, &driver_handle);

  /* Invalid driver handle. */
  ret = hii_database_protocol->get_package_list_handle(
                  hii_database_protocol, handle, NULL);

I could verify that EFI_INVALID_PARAMETER is indeed returned in both cases.
Just let me know and I will post a v2.

Best regards,
Vincent.

> 
> Best regards
> 
> Heinrich
> 
> > +		efi_st_error("get_package_list_handle returned %u not invalid\n",
> > +			     (unsigned int)ret);
> > +		goto out;
> > +	}
> > +
> >   	result = EFI_ST_SUCCESS;
> > 
> >   out:
> 

  reply	other threads:[~2023-01-05 14:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-13 21:39 [PATCH 0/2] efi: small hii conformance fix Vincent Stehlé
2022-12-13 21:39 ` [PATCH 1/2] efi_loader: fix get_package_list_handle() status Vincent Stehlé
2022-12-14  9:12   ` AKASHI Takahiro
2022-12-22  9:37   ` Heinrich Schuchardt
2022-12-13 21:39 ` [PATCH 2/2] efi_selftest: add hii database protocol test case Vincent Stehlé
2022-12-22  9:45   ` Heinrich Schuchardt
2023-01-05 14:48     ` Vincent Stehlé [this message]
2023-01-05 17:03       ` Heinrich Schuchardt

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=Y7bjOU2nVlGdxn98@debian \
    --to=vincent.stehle@arm.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=takahiro.akashi@linaro.org \
    --cc=u-boot@lists.denx.de \
    --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