@@ -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:
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(+)