Re: [PATCH 2/5] efi: use ucs2_as_utf8 in efivarfs instead of open coding a bad version (v2)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 04 Feb, at 10:34:31AM, Peter Jones wrote:
> Translate EFI's UCS-2 variable names to UTF-8 instead of just assuming
> all variable names fit in ASCII.
> 
> v2: fix where I'd accidentally left some of the sizes off when
>     converting the variable name strings.
> 
> Signed-off-by: Peter Jones <pjones@xxxxxxxxxx>
> Tested-by: Lee, Chun-Yi <jlee@xxxxxxxx>
> Acked-by: Matthew Garrett <mjg59@xxxxxxxxxx>
> ---
>  drivers/firmware/efi/efivars.c | 14 +++++---------
>  fs/efivarfs/super.c            |  7 +++----
>  2 files changed, 8 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/firmware/efi/efivars.c b/drivers/firmware/efi/efivars.c
> index 756eca8..cd53c4d 100644
> --- a/drivers/firmware/efi/efivars.c
> +++ b/drivers/firmware/efi/efivars.c
> @@ -540,7 +540,7 @@ static ssize_t efivar_delete(struct file *filp, struct kobject *kobj,
>  static int
>  efivar_create_sysfs_entry(struct efivar_entry *new_var)
>  {
> -	int i, short_name_size;
> +	int short_name_size;
>  	char *short_name;
>  	unsigned long variable_name_size;
>  	efi_char16_t *variable_name;
> @@ -553,22 +553,18 @@ efivar_create_sysfs_entry(struct efivar_entry *new_var)
>  	 * Length of the variable bytes in ASCII, plus the '-' separator,
>  	 * plus the GUID, plus trailing NUL
>  	 */
> -	short_name_size = variable_name_size / sizeof(efi_char16_t)
> -				+ 1 + EFI_VARIABLE_GUID_LEN + 1;
> +	short_name_size = ucs2_utf8size(new_var->var.VariableName)
> +					+ 1 + EFI_VARIABLE_GUID_LEN + 1;
>  

'variable_name_size' is now unused, so you can delete it.
--
To unsubscribe from this list: send the line "unsubscribe linux-efi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux