[PATCH 1/1] efi_loader: use u16_strlen() in efi_var_mem_ins()

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Thu Dec 29 10:35:13 CET 2022


Don't duplicate library functionality.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
---
 lib/efi_loader/efi_var_mem.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/lib/efi_loader/efi_var_mem.c b/lib/efi_loader/efi_var_mem.c
index 0bac594e00..d71ccb31df 100644
--- a/lib/efi_loader/efi_var_mem.c
+++ b/lib/efi_loader/efi_var_mem.c
@@ -142,14 +142,10 @@ efi_status_t __efi_runtime efi_var_mem_ins(
 {
 	u16 *data;
 	struct efi_var_entry *var;
-	u32 var_name_len;
 
 	var = (struct efi_var_entry *)
 	      ((uintptr_t)efi_var_buf + efi_var_buf->length);
-	for (var_name_len = 0; variable_name[var_name_len]; ++var_name_len)
-		;
-	++var_name_len;
-	data = var->name + var_name_len;
+	data = var->name + u16_strlen(var->name) + 1;
 
 	if ((uintptr_t)data - (uintptr_t)efi_var_buf + size1 + size2 >
 	    EFI_VAR_BUF_SIZE)
-- 
2.37.2



More information about the U-Boot mailing list