]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_loader: use u16_strlen() in efi_var_mem_ins()
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Thu, 29 Dec 2022 09:50:54 +0000 (10:50 +0100)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Thu, 29 Dec 2022 11:52:39 +0000 (12:52 +0100)
Don't duplicate library functionality.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
lib/efi_loader/efi_var_mem.c

index 0bac594e004d1f1011f8516cfa6bd61698e6a58a..e1058e3c6aafd14e6e7a7daddcaff67aed02701c 100644 (file)
@@ -146,9 +146,7 @@ efi_status_t __efi_runtime efi_var_mem_ins(
 
        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;
+       var_name_len = u16_strlen(variable_name) + 1;
        data = var->name + var_name_len;
 
        if ((uintptr_t)data - (uintptr_t)efi_var_buf + size1 + size2 >