* efi_get_next_variable_name_mem() - Runtime common code across efi variable
* implementations for GetNextVariable()
* from the cached memory copy
- * @variable_name_size: size of variable_name buffer in byte
+ *
+ * @variable_name_size: size of variable_name buffer in bytes
* @variable_name: name of uefi variable's name in u16
* @vendor: vendor's guid
*
u16 *variable_name, efi_guid_t *vendor)
{
struct efi_var_entry *var;
- efi_uintn_t old_size;
+ efi_uintn_t len, old_size;
u16 *pdata;
if (!variable_name_size || !variable_name || !vendor)
return EFI_INVALID_PARAMETER;
- if (u16_strnlen(variable_name, *variable_name_size) ==
- *variable_name_size)
+ len = *variable_name_size >> 1;
+ if (u16_strnlen(variable_name, len) == len)
return EFI_INVALID_PARAMETER;
if (!efi_var_mem_find(vendor, variable_name, &var) && *variable_name)