]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
boot: Use strsize8/16
authorJan Janssen <medhefgo@web.de>
Tue, 24 May 2022 09:07:04 +0000 (11:07 +0200)
committerJan Janssen <medhefgo@web.de>
Tue, 31 May 2022 13:14:56 +0000 (15:14 +0200)
src/boot/efi/boot.c
src/boot/efi/linux.c
src/boot/efi/measure.c
src/boot/efi/util.c

index 1b45aef50bd21da11a980db158683315a9be2441..b75e4261a48864a9fcda3c6bf23df65ea5bd049d 100644 (file)
@@ -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;
index f04f81fb0567ce1bc53e8983e06b4a8f891ff527..31413ed3a494322459622864602e4ad4b914983c 100644 (file)
@@ -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 */
index da4fd18ea8c28e45ef1451c044b4370d07f20bfb..7579b756c5c01f56c51529ae395711f536a66079 100644 (file)
@@ -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);
         }
index e344c450c8a044b8570bf84ed38044793a436529..2827dae8ff914840f013de342c6c519396ee0cdc 100644 (file)
@@ -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) {