* [PATCH v2] efi_selftest: add hii database protocol test cases
@ 2023-01-06 9:24 Vincent Stehlé
0 siblings, 0 replies; only message in thread
From: Vincent Stehlé @ 2023-01-06 9:24 UTC (permalink / raw)
To: u-boot; +Cc: Vincent Stehlé, Heinrich Schuchardt, Ilias Apalodimas
Add a couple of tests for the cases when the HII database protocol
get_package_list_handle() function is called with invalid parameters.
Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
---
Hi,
Thanks Heinrich for your review and feedbacks; here is v2 of this patch.
Best regards,
Vincent.
Changes in v2:
- Change initialization of driver_handle to a non-NULL value, which will
never get allocated.
- Add a second test for the case when driver handle is invalid.
v1 reference(s):
- https://lists.denx.de/pipermail/u-boot/2022-December/502213.html
- https://lists.denx.de/pipermail/u-boot/2023-January/503718.html
lib/efi_selftest/efi_selftest_hii.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/lib/efi_selftest/efi_selftest_hii.c b/lib/efi_selftest/efi_selftest_hii.c
index eaf3b0995d4..608e3982399 100644
--- a/lib/efi_selftest/efi_selftest_hii.c
+++ b/lib/efi_selftest/efi_selftest_hii.c
@@ -605,6 +605,25 @@ static int test_hii_database_get_package_list_handle(void)
goto out;
}
+ /* Invalid package list handle. */
+ driver_handle = (efi_handle_t)~1UL;
+ ret = hii_database_protocol->get_package_list_handle(
+ hii_database_protocol, NULL, &driver_handle);
+ if (ret != EFI_INVALID_PARAMETER) {
+ efi_st_error("get_package_list_handle returned %u not invalid\n",
+ (unsigned int)ret);
+ goto out;
+ }
+
+ /* Invalid driver handle. */
+ ret = hii_database_protocol->get_package_list_handle(
+ hii_database_protocol, handle, NULL);
+ if (ret != EFI_INVALID_PARAMETER) {
+ efi_st_error("get_package_list_handle returned %u not invalid\n",
+ (unsigned int)ret);
+ goto out;
+ }
+
result = EFI_ST_SUCCESS;
out:
--
2.39.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-01-06 9:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-06 9:24 [PATCH v2] efi_selftest: add hii database protocol test cases Vincent Stehlé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).