From 487d8c75f1d3a1cf084e7fd61955591edc083f80 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 15 May 2019 19:32:43 +0200 Subject: [PATCH 01/10] efi_loader: GetVariable set attributes for EFI_BUFFER_TOO_SMALL UEFI spec 2.7 erratum A leaves it undefined if Attributes should be set if GetVariable() returns EFI_BUFFER_TOO_SMALL. UEFI spec 2.8 defines that Attributes should be set if the return value is either EFI_SUCCESS or EFI_BUFFER_TOO_SMALL. Set Attributes if the return value is EFI_BUFFER_TOO_SMALL. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_variable.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c index 37728c3c16..28b1aa7505 100644 --- a/lib/efi_loader/efi_variable.c +++ b/lib/efi_loader/efi_variable.c @@ -202,8 +202,10 @@ efi_status_t EFIAPI efi_get_variable(u16 *variable_name, len /= 2; *data_size = len; - if (in_size < len) - return EFI_EXIT(EFI_BUFFER_TOO_SMALL); + if (in_size < len) { + ret = EFI_BUFFER_TOO_SMALL; + goto out; + } if (!data) return EFI_EXIT(EFI_INVALID_PARAMETER); @@ -217,8 +219,10 @@ efi_status_t EFIAPI efi_get_variable(u16 *variable_name, *data_size = len; - if (in_size < len) - return EFI_EXIT(EFI_BUFFER_TOO_SMALL); + if (in_size < len) { + ret = EFI_BUFFER_TOO_SMALL; + goto out; + } if (!data) return EFI_EXIT(EFI_INVALID_PARAMETER); @@ -232,10 +236,11 @@ efi_status_t EFIAPI efi_get_variable(u16 *variable_name, return EFI_EXIT(EFI_DEVICE_ERROR); } +out: if (attributes) *attributes = attr & EFI_VARIABLE_MASK; - return EFI_EXIT(EFI_SUCCESS); + return EFI_EXIT(ret); } static char *efi_variables_list; From ce54fdc492dfac6c52fcd369a7414d5ef1f3ded9 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 15 May 2019 23:27:43 +0200 Subject: [PATCH 02/10] efi_loader: parameter checks simple network protocol Check buffer pointers are not NULL as required by the UEFI 2.7 spec. Return EFI_UNSUPPORTED instead of EFI_INVALID_PARAMETER when trying to transmit with non-zero header_size. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_net.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c index e0e222a70b..d71c663068 100644 --- a/lib/efi_loader/efi_net.c +++ b/lib/efi_loader/efi_net.c @@ -392,7 +392,7 @@ static efi_status_t EFIAPI efi_net_transmit efi_timer_check(); /* Check parameters */ - if (!this) { + if (!this || !buffer) { ret = EFI_INVALID_PARAMETER; goto out; } @@ -408,7 +408,7 @@ static efi_status_t EFIAPI efi_net_transmit * TODO: We would need to create the header * if header_size != 0 */ - ret = EFI_INVALID_PARAMETER; + ret = EFI_UNSUPPORTED; goto out; } @@ -466,7 +466,7 @@ static efi_status_t EFIAPI efi_net_receive efi_timer_check(); /* Check parameters */ - if (!this) { + if (!this || !buffer || !buffer_size) { ret = EFI_INVALID_PARAMETER; goto out; } From f005f573a80cf4cd413292edf3d6c87dd2daf84d Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 16 May 2019 07:37:22 +0200 Subject: [PATCH 03/10] efi_loader: merge adjacent sprintf() In the implementation of the device path to text protocol join adjacent sprintf() statements. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_device_path_to_text.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/efi_loader/efi_device_path_to_text.c b/lib/efi_loader/efi_device_path_to_text.c index f3a9579076..96fd08971b 100644 --- a/lib/efi_loader/efi_device_path_to_text.c +++ b/lib/efi_loader/efi_device_path_to_text.c @@ -79,9 +79,8 @@ static char *dp_acpi(char *s, struct efi_device_path *dp) struct efi_device_path_acpi_path *adp = (struct efi_device_path_acpi_path *)dp; - s += sprintf(s, "Acpi(PNP%04X", EISA_PNP_NUM(adp->hid)); - s += sprintf(s, ",%d", adp->uid); - s += sprintf(s, ")"); + s += sprintf(s, "Acpi(PNP%04X,%d)", EISA_PNP_NUM(adp->hid), + adp->uid); break; } default: From 95ab3816769827f73960f9c4347839e380c15c17 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 16 May 2019 07:52:58 +0200 Subject: [PATCH 04/10] efi_loader: rename Unicode collation protocol 2 variables Rename variables to make it clear they refer to the Unicode collation protocol identified by the EFI_UNICODE_PROTOCOL2_GUID. Signed-off-by: Heinrich Schuchardt --- include/efi_loader.h | 4 ++-- lib/efi_loader/Kconfig | 4 ++-- lib/efi_loader/Makefile | 2 +- lib/efi_loader/efi_root_node.c | 6 +++--- lib/efi_loader/efi_unicode_collation.c | 6 +++--- lib/efi_selftest/Makefile | 3 ++- 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/include/efi_loader.h b/include/efi_loader.h index 07ef14ba1c..835007e179 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -108,7 +108,7 @@ extern const struct efi_device_path_utilities_protocol efi_device_path_utilities; /* Implementation of the EFI_UNICODE_COLLATION_PROTOCOL */ extern const struct efi_unicode_collation_protocol - efi_unicode_collation_protocol; + efi_unicode_collation_protocol2; extern const struct efi_hii_config_routing_protocol efi_hii_config_routing; extern const struct efi_hii_config_access_protocol efi_hii_config_access; extern const struct efi_hii_database_protocol efi_hii_database; @@ -146,7 +146,7 @@ extern const efi_guid_t efi_file_info_guid; extern const efi_guid_t efi_file_system_info_guid; extern const efi_guid_t efi_guid_device_path_utilities_protocol; /* GUID of the Unicode collation protocol */ -extern const efi_guid_t efi_guid_unicode_collation_protocol; +extern const efi_guid_t efi_guid_unicode_collation_protocol2; extern const efi_guid_t efi_guid_hii_config_routing_protocol; extern const efi_guid_t efi_guid_hii_config_access_protocol; extern const efi_guid_t efi_guid_hii_database_protocol; diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index 6501ee56aa..7e13ee54b2 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -36,14 +36,14 @@ config EFI_LOADER_HII U-Boot implements enough of its features to be able to run the UEFI Shell, but not more than that. -config EFI_UNICODE_COLLATION_PROTOCOL +config EFI_UNICODE_COLLATION_PROTOCOL2 bool "Unicode collation protocol" default y help The Unicode collation protocol is used for lexical comparisons. It is required to run the UEFI shell. -if EFI_UNICODE_COLLATION_PROTOCOL +if EFI_UNICODE_COLLATION_PROTOCOL2 config EFI_UNICODE_CAPITALIZATION bool "Support Unicode capitalization" diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile index f3d6773bf6..01769ea58b 100644 --- a/lib/efi_loader/Makefile +++ b/lib/efi_loader/Makefile @@ -30,7 +30,7 @@ obj-y += efi_memory.o obj-y += efi_root_node.o obj-y += efi_runtime.o obj-y += efi_setup.o -obj-$(CONFIG_EFI_UNICODE_COLLATION_PROTOCOL) += efi_unicode_collation.o +obj-$(CONFIG_EFI_UNICODE_COLLATION_PROTOCOL2) += efi_unicode_collation.o obj-y += efi_variable.o obj-y += efi_watchdog.o obj-$(CONFIG_LCD) += efi_gop.o diff --git a/lib/efi_loader/efi_root_node.c b/lib/efi_loader/efi_root_node.c index d8496cc3c2..2b7277de05 100644 --- a/lib/efi_loader/efi_root_node.c +++ b/lib/efi_loader/efi_root_node.c @@ -60,10 +60,10 @@ efi_status_t efi_root_node_register(void) /* Device path utilities protocol */ &efi_guid_device_path_utilities_protocol, (void *)&efi_device_path_utilities, -#if CONFIG_IS_ENABLED(EFI_UNICODE_COLLATION_PROTOCOL) +#if CONFIG_IS_ENABLED(EFI_UNICODE_COLLATION_PROTOCOL2) /* Unicode collation protocol */ - &efi_guid_unicode_collation_protocol, - (void *)&efi_unicode_collation_protocol, + &efi_guid_unicode_collation_protocol2, + (void *)&efi_unicode_collation_protocol2, #endif #if CONFIG_IS_ENABLED(EFI_LOADER_HII) /* HII string protocol */ diff --git a/lib/efi_loader/efi_unicode_collation.c b/lib/efi_loader/efi_unicode_collation.c index 7f3ea3c77e..e04a4de5b7 100644 --- a/lib/efi_loader/efi_unicode_collation.c +++ b/lib/efi_loader/efi_unicode_collation.c @@ -26,8 +26,8 @@ static const u16 codepage[] = CP1250; static const u16 codepage[] = CP437; #endif -/* GUID of the EFI_UNICODE_COLLATION_PROTOCOL */ -const efi_guid_t efi_guid_unicode_collation_protocol = +/* GUID of the EFI_UNICODE_COLLATION_PROTOCOL2 */ +const efi_guid_t efi_guid_unicode_collation_protocol2 = EFI_UNICODE_COLLATION_PROTOCOL2_GUID; /** @@ -318,7 +318,7 @@ static bool EFIAPI efi_str_to_fat(struct efi_unicode_collation_protocol *this, return ret; } -const struct efi_unicode_collation_protocol efi_unicode_collation_protocol = { +const struct efi_unicode_collation_protocol efi_unicode_collation_protocol2 = { .stri_coll = efi_stri_coll, .metai_match = efi_metai_match, .str_lwr = efi_str_lwr, diff --git a/lib/efi_selftest/Makefile b/lib/efi_selftest/Makefile index d0bebc7d0c..cfbb40c891 100644 --- a/lib/efi_selftest/Makefile +++ b/lib/efi_selftest/Makefile @@ -38,7 +38,8 @@ efi_selftest_variables.o \ efi_selftest_watchdog.o obj-$(CONFIG_EFI_DEVICE_PATH_TO_TEXT) += efi_selftest_devicepath.o -obj-$(CONFIG_EFI_UNICODE_COLLATION_PROTOCOL) += efi_selftest_unicode_collation.o +obj-$(CONFIG_EFI_UNICODE_COLLATION_PROTOCOL2) += \ +efi_selftest_unicode_collation.o obj-$(CONFIG_CPU_V7) += efi_selftest_unaligned.o obj-$(CONFIG_EFI_LOADER_HII) += efi_selftest_hii.o From b1b782d30608701d1901c1a83702ee9671a1d012 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 16 May 2019 18:19:00 +0200 Subject: [PATCH 05/10] efi_loader: implement deprecated Unicode collation protocol In EFI 1.10 a version of the Unicode collation protocol using ISO 639-2 language codes existed. This protocol is not part of the UEFI specification any longer. Unfortunately it is required to run the UEFI Self Certification Test (SCT) II, version 2.6, 2017. So we implement it here for the sole purpose of running the SCT. It can be removed once a compliant SCT is available. The configuration option defaults to no. Signed-off-by: Rob Clark Most of Rob's original patch is already merged. Only the deprecated protocol is missing. Rebase it and make it configurable. Signed-off-by: Heinrich Schuchardt --- include/efi_api.h | 5 +++++ include/efi_loader.h | 7 ++++++- lib/efi_loader/Kconfig | 11 +++++++++++ lib/efi_loader/efi_root_node.c | 7 ++++++- lib/efi_loader/efi_unicode_collation.c | 27 ++++++++++++++++++++++++++ 5 files changed, 55 insertions(+), 2 deletions(-) diff --git a/include/efi_api.h b/include/efi_api.h index 755c405793..7dcd82b681 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -1425,6 +1425,11 @@ struct efi_driver_binding_protocol { efi_handle_t driver_binding_handle; }; +/* Deprecated version of the Unicode collation protocol */ +#define EFI_UNICODE_COLLATION_PROTOCOL_GUID \ + EFI_GUID(0x1d85cd7f, 0xf43d, 0x11d2, \ + 0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d) +/* Current version of the Unicode collation protocol */ #define EFI_UNICODE_COLLATION_PROTOCOL2_GUID \ EFI_GUID(0xa4c751fc, 0x23ae, 0x4c3e, \ 0x92, 0xe9, 0x49, 0x64, 0xcf, 0x63, 0xf3, 0x49) diff --git a/include/efi_loader.h b/include/efi_loader.h index 835007e179..8167e6ffcb 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -106,7 +106,10 @@ extern const struct efi_device_path_to_text_protocol efi_device_path_to_text; /* implementation of the EFI_DEVICE_PATH_UTILITIES_PROTOCOL */ extern const struct efi_device_path_utilities_protocol efi_device_path_utilities; -/* Implementation of the EFI_UNICODE_COLLATION_PROTOCOL */ +/* deprecated version of the EFI_UNICODE_COLLATION_PROTOCOL */ +extern const struct efi_unicode_collation_protocol + efi_unicode_collation_protocol; +/* current version of the EFI_UNICODE_COLLATION_PROTOCOL */ extern const struct efi_unicode_collation_protocol efi_unicode_collation_protocol2; extern const struct efi_hii_config_routing_protocol efi_hii_config_routing; @@ -145,6 +148,8 @@ extern const efi_guid_t efi_file_info_guid; /* GUID for file system information */ extern const efi_guid_t efi_file_system_info_guid; extern const efi_guid_t efi_guid_device_path_utilities_protocol; +/* GUID of the deprecated Unicode collation protocol */ +extern const efi_guid_t efi_guid_unicode_collation_protocol; /* GUID of the Unicode collation protocol */ extern const efi_guid_t efi_guid_unicode_collation_protocol2; extern const efi_guid_t efi_guid_hii_config_routing_protocol; diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index 7e13ee54b2..fc04ea39d0 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -54,6 +54,17 @@ config EFI_UNICODE_CAPITALIZATION set, only the the correct handling of the letters of the codepage used by the FAT file system is ensured. +config EFI_UNICODE_COLLATION_PROTOCOL + bool "Deprecated version of the Unicode collation protocol" + default n + help + In EFI 1.10 a version of the Unicode collation protocol using ISO + 639-2 language codes existed. This protocol is not part of the UEFI + specification any longer. Unfortunately it is required to run the + UEFI Self Certification Test (SCT) II, version 2.6, 2017. + + Choose this option for testing only. It is bound to be removed. + endif config EFI_LOADER_BOUNCE_BUFFER diff --git a/lib/efi_loader/efi_root_node.c b/lib/efi_loader/efi_root_node.c index 2b7277de05..f68b0fdc61 100644 --- a/lib/efi_loader/efi_root_node.c +++ b/lib/efi_loader/efi_root_node.c @@ -61,7 +61,12 @@ efi_status_t efi_root_node_register(void) &efi_guid_device_path_utilities_protocol, (void *)&efi_device_path_utilities, #if CONFIG_IS_ENABLED(EFI_UNICODE_COLLATION_PROTOCOL2) - /* Unicode collation protocol */ +#if CONFIG_IS_ENABLED(EFI_UNICODE_COLLATION_PROTOCOL) + /* Deprecated Unicode collation protocol */ + &efi_guid_unicode_collation_protocol, + (void *)&efi_unicode_collation_protocol, +#endif + /* Current Unicode collation protocol */ &efi_guid_unicode_collation_protocol2, (void *)&efi_unicode_collation_protocol2, #endif diff --git a/lib/efi_loader/efi_unicode_collation.c b/lib/efi_loader/efi_unicode_collation.c index e04a4de5b7..06fddca1c4 100644 --- a/lib/efi_loader/efi_unicode_collation.c +++ b/lib/efi_loader/efi_unicode_collation.c @@ -327,3 +327,30 @@ const struct efi_unicode_collation_protocol efi_unicode_collation_protocol2 = { .str_to_fat = efi_str_to_fat, .supported_languages = "en", }; + +/* + * In EFI 1.10 a version of the Unicode collation protocol using ISO 639-2 + * language codes existed. This protocol is not part of the UEFI specification + * any longer. Unfortunately it is required to run the UEFI Self Certification + * Test (SCT) II, version 2.6, 2017. So we implement it here for the sole + * purpose of running the SCT. It can be removed when a compliant SCT is + * available. + */ +#if CONFIG_IS_ENABLED(EFI_UNICODE_COLLATION_PROTOCOL) + +/* GUID of the EFI_UNICODE_COLLATION_PROTOCOL */ +const efi_guid_t efi_guid_unicode_collation_protocol = + EFI_UNICODE_COLLATION_PROTOCOL_GUID; + +const struct efi_unicode_collation_protocol efi_unicode_collation_protocol = { + .stri_coll = efi_stri_coll, + .metai_match = efi_metai_match, + .str_lwr = efi_str_lwr, + .str_upr = efi_str_upr, + .fat_to_str = efi_fat_to_str, + .str_to_fat = efi_str_to_fat, + /* ISO 639-2 language code */ + .supported_languages = "eng", +}; + +#endif From 226cddbe32f0bc0df92aaaa5500a5c1f4eabf8dc Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 16 May 2019 21:54:04 +0200 Subject: [PATCH 06/10] efi_loader: check device path in InstallMultipleProtocolInterfaces According to the UEFI spec InstallMultipleProtocolInterfaces() must check if a device path has already been installed. In this case it must return EFI_ALREADY_STARTED. Cf. UEFI SCT II 2.6 A (2017), 3.3.16 InstallMultipleProtocolInterfaces(), 5.1.3.16.1. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_boottime.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index ec6f5758de..d3f21f15b7 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -2334,6 +2334,7 @@ efi_status_t EFIAPI efi_install_multiple_protocol_interfaces efi_va_list argptr; const efi_guid_t *protocol; void *protocol_interface; + efi_handle_t old_handle; efi_status_t r = EFI_SUCCESS; int i = 0; @@ -2346,6 +2347,17 @@ efi_status_t EFIAPI efi_install_multiple_protocol_interfaces if (!protocol) break; protocol_interface = efi_va_arg(argptr, void*); + /* Check that a device path has not been installed before */ + if (!guidcmp(protocol, &efi_guid_device_path)) { + struct efi_device_path *dp = protocol_interface; + + r = EFI_CALL(efi_locate_device_path(protocol, &dp, + &old_handle)); + if (r == EFI_SUCCESS) { + r = EFI_ALREADY_STARTED; + break; + } + } r = EFI_CALL(efi_install_protocol_interface( handle, protocol, EFI_NATIVE_INTERFACE, From db80fe3866c60dc263b50c4c3724c72e91d6fe04 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 16 May 2019 23:31:29 +0200 Subject: [PATCH 07/10] efi_loader: parameter checks CalculateCrc32() Not checking the parameters may lead reading or writing from NULL. Implement the parameter checks prescribed in the UEFI spec. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_boottime.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index d3f21f15b7..ce6ca06f75 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -2465,9 +2465,16 @@ static efi_status_t EFIAPI efi_calculate_crc32(const void *data, efi_uintn_t data_size, u32 *crc32_p) { + efi_status_t ret = EFI_SUCCESS; + EFI_ENTRY("%p, %zu", data, data_size); + if (!data || !data_size || !crc32_p) { + ret = EFI_INVALID_PARAMETER; + goto out; + } *crc32_p = crc32(0, data, data_size); - return EFI_EXIT(EFI_SUCCESS); +out: + return EFI_EXIT(ret); } /** From 1344f7d0f61d94fe475aeadb000ac6cafccd3920 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Fri, 17 May 2019 12:47:17 +0200 Subject: [PATCH 08/10] efi_loader: GetNextMonotonicCount() check parameter Do not write to address indicated by NULL pointer. UEFI SCT II 2.6 (2017), 3.6.5 GetNextMonotonicCount(), 5.1.5.5.1 Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_boottime.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index ce6ca06f75..971bd5ffa3 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -1916,10 +1916,17 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle, static efi_status_t EFIAPI efi_get_next_monotonic_count(uint64_t *count) { static uint64_t mono; + efi_status_t ret; EFI_ENTRY("%p", count); + if (!count) { + ret = EFI_INVALID_PARAMETER; + goto out; + } *count = mono++; - return EFI_EXIT(EFI_SUCCESS); + ret = EFI_SUCCESS; +out: + return EFI_EXIT(ret); } /** From acee965263e8d04d07f9b36d54a4bc8bde30727c Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 18 May 2019 17:07:52 +0200 Subject: [PATCH 09/10] efi_loader: EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState() correct parameter KeyToggleState is a pointer according to UEFI spec 2.8. Signed-off-by: Heinrich Schuchardt --- include/efi_api.h | 2 +- lib/efi_loader/efi_console.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/efi_api.h b/include/efi_api.h index 7dcd82b681..65584dd2d8 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -639,7 +639,7 @@ struct efi_simple_text_input_ex_protocol { struct efi_event *wait_for_key_ex; efi_status_t (EFIAPI *set_state) ( struct efi_simple_text_input_ex_protocol *this, - u8 key_toggle_state); + u8 *key_toggle_state); efi_status_t (EFIAPI *register_key_notify) ( struct efi_simple_text_input_ex_protocol *this, struct efi_key_data *key_data, diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c index 051fc1d339..909fd5c29e 100644 --- a/lib/efi_loader/efi_console.c +++ b/lib/efi_loader/efi_console.c @@ -825,7 +825,7 @@ out: * efi_cin_set_state() - set toggle key state * * @this: instance of the EFI_SIMPLE_TEXT_INPUT_PROTOCOL - * @key_toggle_state: key toggle state + * @key_toggle_state: pointer to key toggle state * Return: status code * * This function implements the SetState service of the @@ -836,9 +836,9 @@ out: */ static efi_status_t EFIAPI efi_cin_set_state( struct efi_simple_text_input_ex_protocol *this, - u8 key_toggle_state) + u8 *key_toggle_state) { - EFI_ENTRY("%p, %u", this, key_toggle_state); + EFI_ENTRY("%p, %p", this, key_toggle_state); /* * U-Boot supports multiple console input sources like serial and * net console for which a key toggle state cannot be set at all. From b31ca6bf8484ca10bab4ae544698294a4197bef9 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 18 May 2019 18:11:54 +0200 Subject: [PATCH 10/10] efi_loader: parameter check OutputString Check the parameters against NULL. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_console.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c index 909fd5c29e..b2cb18e6d6 100644 --- a/lib/efi_loader/efi_console.c +++ b/lib/efi_loader/efi_console.c @@ -136,6 +136,11 @@ static efi_status_t EFIAPI efi_cout_output_string( EFI_ENTRY("%p, %p", this, string); + if (!this || !string) { + ret = EFI_INVALID_PARAMETER; + goto out; + } + buf = malloc(utf16_utf8_strlen(string) + 1); if (!buf) { ret = EFI_OUT_OF_RESOURCES;