From: Jan Janssen Date: Tue, 24 May 2022 09:07:04 +0000 (+0200) Subject: boot: Use strsize8/16 X-Git-Tag: v252-rc1~892^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=60c2af56d6fc4e6aa65f297c80deb0bf8a5f69ee;p=thirdparty%2Fsystemd.git boot: Use strsize8/16 --- diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c index 1b45aef50bd..b75e4261a48 100644 --- a/src/boot/efi/boot.c +++ b/src/boot/efi/boot.c @@ -2375,7 +2375,7 @@ static EFI_STATUS image_start( CHAR16 *options = options_initrd ?: entry->options; if (options) { loaded_image->LoadOptions = options; - loaded_image->LoadOptionsSize = StrSize(options); + loaded_image->LoadOptionsSize = strsize16(options); /* Try to log any options to the TPM, especially to catch manually edited options */ (void) tpm_log_load_options(options); @@ -2426,14 +2426,14 @@ static void config_write_entries_to_variable(Config *config) { assert(config); for (UINTN i = 0; i < config->entry_count; i++) - sz += StrSize(config->entries[i]->id); + sz += strsize16(config->entries[i]->id); p = buffer = xallocate_pool(sz); for (UINTN i = 0; i < config->entry_count; i++) { UINTN l; - l = StrSize(config->entries[i]->id); + l = strsize16(config->entries[i]->id); CopyMem(p, config->entries[i]->id, l); p += l; diff --git a/src/boot/efi/linux.c b/src/boot/efi/linux.c index f04f81fb056..31413ed3a49 100644 --- a/src/boot/efi/linux.c +++ b/src/boot/efi/linux.c @@ -45,7 +45,7 @@ static EFI_STATUS loaded_image_register( /* if a cmdline is set convert it to UCS2 */ if (cmdline) { loaded_image->LoadOptions = xstra_to_str(cmdline); - loaded_image->LoadOptionsSize = StrSize(loaded_image->LoadOptions); + loaded_image->LoadOptionsSize = strsize16(loaded_image->LoadOptions); } /* install a new LoadedImage protocol. ret_handle is a new image handle */ diff --git a/src/boot/efi/measure.c b/src/boot/efi/measure.c index da4fd18ea8c..7579b756c5c 100644 --- a/src/boot/efi/measure.c +++ b/src/boot/efi/measure.c @@ -25,7 +25,7 @@ static EFI_STATUS tpm1_measure_to_pcr_and_event_log( assert(tcg); assert(description); - desc_len = StrSize(description); + desc_len = strsize16(description); tcg_event = xallocate_zero_pool(offsetof(TCG_PCR_EVENT, Event) + desc_len); *tcg_event = (TCG_PCR_EVENT) { .EventSize = desc_len, @@ -56,7 +56,7 @@ static EFI_STATUS tpm2_measure_to_pcr_and_event_log( assert(tcg); assert(description); - desc_len = StrSize(description); + desc_len = strsize16(description); tcg_event = xallocate_zero_pool(offsetof(EFI_TCG2_EVENT, Event) + desc_len); *tcg_event = (EFI_TCG2_EVENT) { .Size = offsetof(EFI_TCG2_EVENT, Event) + desc_len, @@ -171,7 +171,7 @@ EFI_STATUS tpm_log_load_options(const CHAR16 *load_options) { err = tpm_log_event(pcr, POINTER_TO_PHYSICAL_ADDRESS(load_options), - StrSize(load_options), load_options); + strsize16(load_options), load_options); if (EFI_ERROR(err)) return log_error_status_stall(err, L"Unable to add load options (i.e. kernel command) line measurement to PCR %u: %r", pcr, err); } diff --git a/src/boot/efi/util.c b/src/boot/efi/util.c index e344c450c8a..2827dae8ff9 100644 --- a/src/boot/efi/util.c +++ b/src/boot/efi/util.c @@ -40,7 +40,7 @@ EFI_STATUS efivar_set(const EFI_GUID *vendor, const CHAR16 *name, const CHAR16 * assert(vendor); assert(name); - return efivar_set_raw(vendor, name, value, value ? StrSize(value) : 0, flags); + return efivar_set_raw(vendor, name, value, value ? strsize16(value) : 0, flags); } EFI_STATUS efivar_set_uint_string(const EFI_GUID *vendor, const CHAR16 *name, UINTN i, UINT32 flags) {