Skip to contentSkip to conversation

partitions/efi: Fix partition name parsing in GUID partition entry

PATCH New Nikolai Merinov 5 participants 13 messages Nov 24, 2018 – Mar 6, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 partitions/efi: Fix partition name parsing in GUID partition entry

GUID partition entry defined to have a partition name as 36 UTF-16LE code units. This means that on big-endian platforms ASCII symbols would be read with 0xXX00 efi_char16_t character code. In order to correctly extract ASCII characters from a partition name field we should be converted from 16LE to CPU architecture.

The problem exists on all big endian platforms.

---
 block/partitions/efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/partitions/efi.c +1 -1
index 39f70d968754..ea50ee1505ed 100644
@@ -729,7 +729,7 @@ int efi_partition(struct parsed_partitions *state)
 				ARRAY_SIZE(ptes[i].partition_name));
 		info->volname[label_max] = 0;
 		while (label_count < label_max) {
-			u8 c = ptes[i].partition_name[label_count] & 0xff;
+			u8 c = le16_to_cpu(ptes[i].partition_name[label_count]) & 0xff;
 			if (c && !isprint(c))
 				c = '!';
 			info->volname[label_count] = c;
Signature · 1 line
2.14.1
#1 lore raw
Thank you for the patch! Perhaps something to improve:

Hi Nikolai,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on block/for-next]
[also build test WARNING on v4.20-rc3 next-20181123]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Nikolai-Merinov/partitions-efi-Fix-partition-name-parsing-in-GUID-partition-entry/20181125-060728
base:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

include/linux/slab.h:332:43: warning: dubious: x & !y include/linux/slab.h:332:43: warning: dubious: x & !y include/linux/slab.h:332:43: warning: dubious: x & !y

>> block/partitions/efi.c:732:32: warning: cast to restricted __le16

vim +732 block/partitions/efi.c

672
673 /**
674 * efi_partition(struct parsed_partitions *state)
675 * @state: disk parsed partitions
676 *
677 * Description: called from check.c, if the disk contains GPT
678 * partitions, sets up partition entries in the kernel.
679 *
680 * If the first block on the disk is a legacy MBR,
681 * it will get handled by msdos_partition().
682 * If it's a Protective MBR, we'll handle it here.
683 *
684 * We do not create a Linux partition for GPT, but
685 * only for the actual data partitions.
686 * Returns:
687 * -1 if unable to read the partition table
688 * 0 if this isn't our partition table
689 * 1 if successful
690 *
691 */
692 int efi_partition(struct parsed_partitions *state)
693 {
694 gpt_header *gpt = NULL;
695 gpt_entry *ptes = NULL;
696 u32 i;
697 unsigned ssz = bdev_logical_block_size(state->bdev) / 512;
698
699 if (!find_valid_gpt(state, &gpt, &ptes) || !gpt || !ptes) {
700 kfree(gpt);
701 kfree(ptes);
702 return 0;
703 }
704
705 pr_debug("GUID Partition Table is valid! Yea!\n");
706
707 for (i = 0; i < le32_to_cpu(gpt->num_partition_entries) && i < state->limit-1; i++) {
708 struct partition_meta_info *info;
709 unsigned label_count = 0;
710 unsigned label_max;
711 u64 start = le64_to_cpu(ptes[i].starting_lba);
712 u64 size = le64_to_cpu(ptes[i].ending_lba) -
713 le64_to_cpu(ptes[i].starting_lba) + 1ULL;
714
715 if (!is_pte_valid(&ptes[i], last_lba(state->bdev)))
716 continue;
717
718 put_partition(state, i+1, start * ssz, size * ssz);
719
720 /* If this is a RAID volume, tell md */
721 if (!efi_guidcmp(ptes[i].partition_type_guid, PARTITION_LINUX_RAID_GUID))
722 state->parts[i + 1].flags = ADDPART_FLAG_RAID;
723
724 info = &state->parts[i + 1].info;
725 efi_guid_to_str(&ptes[i].unique_partition_guid, info->uuid);
726
727 /* Naively convert UTF16-LE to 7 bits. */
728 label_max = min(ARRAY_SIZE(info->volname) - 1,
729 ARRAY_SIZE(ptes[i].partition_name));
730 info->volname[label_max] = 0;
731 while (label_count < label_max) {

 > 732				u8 c = le16_to_cpu(ptes[i].partition_name[label_count]) & 0xff;

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#2 lore raw

PATCH v2 1/1 partitions/efi: Fix partition name parsing in GUID partition entry

In reply to Nikolai Merinov

GUID partition entry defined to have a partition name as 36 UTF-16LE code units. This means that on big-endian platforms ASCII symbols would be read with 0xXX00 efi_char16_t character code. In order to correctly extract ASCII characters from a partition name field we should be converted from 16LE to CPU architecture.

The problem exists on all big endian platforms.

block/partitions/efi.c +1 -1
index db2fef7dfc47..51287a8a3bea 100644
@@ -715,7 +715,7 @@ int efi_partition(struct parsed_partitions *state)
 				ARRAY_SIZE(ptes[i].partition_name));
 		info->volname[label_max] = 0;
 		while (label_count < label_max) {
-			u8 c = ptes[i].partition_name[label_count] & 0xff;
+			u8 c = le16_to_cpu(ptes[i].partition_name[label_count]) & 0xff;
 			if (c && !isprint(c))
 				c = '!';
 			info->volname[label_count] = c;
block/partitions/efi.h +1 -1
index 3e8576157575..0b6d5b7be111 100644
@@ -88,7 +88,7 @@ typedef struct _gpt_entry {
 	__le64 starting_lba;
 	__le64 ending_lba;
 	gpt_entry_attributes attributes;
-	efi_char16_t partition_name[72 / sizeof (efi_char16_t)];
+	__le16 partition_name[72 / sizeof (__le16)];
 } __packed gpt_entry;
 
 typedef struct _gpt_mbr_record {
Signature · 1 line
2.17.1
Acked-by on v2 1/1
#3 lore raw
Quoted 11 lines · Nikolai Merinov

GUID partition entry defined to have a partition name as 36 UTF-16LE code units. This means that on big-endian platforms ASCII symbols would be read with 0xXX00 efi_char16_t character code. In order to correctly extract ASCII characters from a partition name field we should be converted from 16LE to CPU architecture.

The problem exists on all big endian platforms.

Quoted 29 lines
block/partitions/efi.c +1 -1
index db2fef7dfc47..51287a8a3bea 100644
@@ -715,7 +715,7 @@ int efi_partition(struct parsed_partitions *state)
                                ARRAY_SIZE(ptes[i].partition_name));
                info->volname[label_max] = 0;
                while (label_count < label_max) {
-                       u8 c = ptes[i].partition_name[label_count] & 0xff;
+                       u8 c = le16_to_cpu(ptes[i].partition_name[label_count]) & 0xff;
                        if (c && !isprint(c))
                                c = '!';
                        info->volname[label_count] = c;
block/partitions/efi.h +1 -2
index 3e8576157575..0b6d5b7be111 100644
@@ -88,7 +88,7 @@ typedef struct _gpt_entry {
        __le64 starting_lba;
        __le64 ending_lba;
        gpt_entry_attributes attributes;
-       efi_char16_t partition_name[72 / sizeof (efi_char16_t)];
+       __le16 partition_name[72 / sizeof (__le16)];
 } __packed gpt_entry;
 
 typedef struct _gpt_mbr_record {
--

2.17.1

#4 lore raw
In reply to Nikolai Merinov

block/partitions/efi.c int efi_partition(struct parsed_partitions *state) · line 721

Quoted 12 lines

index db2fef7dfc47..51287a8a3bea 100644

block/partitions/efi.c +1 -1
@@ -715,7 +715,7 @@ int efi_partition(struct parsed_partitions *state)
 				ARRAY_SIZE(ptes[i].partition_name));
 		info->volname[label_max] = 0;
 		while (label_count < label_max) {
-			u8 c = ptes[i].partition_name[label_count] & 0xff;
+			u8 c = le16_to_cpu(ptes[i].partition_name[label_count]) & 0xff;
 			if (c && !isprint(c))
 				c = '!';
 

This adds an overly long line. Please add a an efi_char_from_cpu or similarly named helper to encapsulate this logic.

Otherwise the change looks good.

#5 lore raw

PATCH v3 1/1 partitions/efi: Fix partition name parsing in GUID partition entry

GUID partition entry defined to have a partition name as 36 UTF-16LE code units. This means that on big-endian platforms ASCII symbols would be read with 0xXX00 efi_char16_t character code. In order to correctly extract ASCII characters from a partition name field we should be converted from 16LE to CPU architecture.

The problem exists on all big endian platforms.

---
 block/partitions/efi.c | 3 ++-
 block/partitions/efi.h | 2 +-
 include/linux/efi.h    | 5 +++++
 3 files changed, 8 insertions(+), 2 deletions(-)
block/partitions/efi.c +2 -1
index db2fef7dfc47..f1d0820de844 100644
@@ -715,7 +715,8 @@ int efi_partition(struct parsed_partitions *state)
 				ARRAY_SIZE(ptes[i].partition_name));
 		info->volname[label_max] = 0;
 		while (label_count < label_max) {
-			u8 c = ptes[i].partition_name[label_count] & 0xff;
+			u8 c = 0xff & efi_char16le_to_cpu(
+					ptes[i].partition_name[label_count]);
 			if (c && !isprint(c))
 				c = '!';
 			info->volname[label_count] = c;
block/partitions/efi.h +1 -1
index 3e8576157575..4d4cae0bb79e 100644
@@ -88,7 +88,7 @@ typedef struct _gpt_entry {
 	__le64 starting_lba;
 	__le64 ending_lba;
 	gpt_entry_attributes attributes;
-	efi_char16_t partition_name[72 / sizeof (efi_char16_t)];
+	efi_char16le_t partition_name[72 / sizeof(efi_char16le_t)];
 } __packed gpt_entry;
 
 typedef struct _gpt_mbr_record {
include/linux/efi.h +5 -0
index aa54586db7a5..47882f2d45db 100644
@@ -45,9 +45,14 @@
 typedef unsigned long efi_status_t;
 typedef u8 efi_bool_t;
 typedef u16 efi_char16_t;		/* UNICODE character */
+typedef __le16 efi_char16le_t;		/* UTF16-LE */
+typedef __be16 efi_char16be_t;		/* UTF16-BE */
 typedef u64 efi_physical_addr_t;
 typedef void *efi_handle_t;
 
+#define efi_char16le_to_cpu le16_to_cpu
+#define efi_char16be_to_cpu be16_to_cpu
+
 /*
  * The UEFI spec and EDK2 reference implementation both define EFI_GUID as
  * struct { u32 a; u16; b; u16 c; u8 d[8]; }; and so the implied alignment
Signature · 1 line
2.17.1
#6 lore raw

Hello,

Did you have a time to look at this patch? Should I make any modification?

Regards,
Nikolai

----- Original Message -----

Quoted 71 lines

From: "n merinov" <[email protected]>
To: [email protected], "Davidlohr Bueso" <[email protected]>, "Jens Axboe" <[email protected]>, "Ard Biesheuvel" <[email protected]>, [email protected], [email protected], "linux-kernel" <[email protected]>
Cc: "n merinov" <[email protected]>
Sent: Monday, January 13, 2020 3:27:23 PM
Subject: [PATCH v3] partitions/efi: Fix partition name parsing in GUID partition entry

GUID partition entry defined to have a partition name as 36 UTF-16LE code units. This means that on big-endian platforms ASCII symbols would be read with 0xXX00 efi_char16_t character code. In order to correctly extract ASCII characters from a partition name field we should be converted from 16LE to CPU architecture.

The problem exists on all big endian platforms.

---

block/partitions/efi.c | 3 ++-
block/partitions/efi.h | 2 +-
include/linux/efi.h    | 5 +++++
3 files changed, 8 insertions(+), 2 deletions(-)
block/partitions/efi.c +2 -1
index db2fef7dfc47..f1d0820de844 100644
@@ -715,7 +715,8 @@ int efi_partition(struct parsed_partitions *state)
 				ARRAY_SIZE(ptes[i].partition_name));
 		info->volname[label_max] = 0;
 		while (label_count < label_max) {
-			u8 c = ptes[i].partition_name[label_count] & 0xff;
+			u8 c = 0xff & efi_char16le_to_cpu(
+					ptes[i].partition_name[label_count]);
 			if (c && !isprint(c))
 				c = '!';
 			info->volname[label_count] = c;
block/partitions/efi.h +1 -1
index 3e8576157575..4d4cae0bb79e 100644
@@ -88,7 +88,7 @@ typedef struct _gpt_entry {
 	__le64 starting_lba;
 	__le64 ending_lba;
 	gpt_entry_attributes attributes;
-	efi_char16_t partition_name[72 / sizeof (efi_char16_t)];
+	efi_char16le_t partition_name[72 / sizeof(efi_char16le_t)];
 } __packed gpt_entry;
 
 typedef struct _gpt_mbr_record {
include/linux/efi.h +0 -0
index aa54586db7a5..47882f2d45db 100644
@@ -45,9 +45,14 @@
 typedef unsigned long efi_status_t;
 typedef u8 efi_bool_t;

typedef u16 efi_char16_t; /* UNICODE character */

include/linux/efi.h +2 -0
+typedef __le16 efi_char16le_t;		/* UTF16-LE */
+typedef __be16 efi_char16be_t;		/* UTF16-BE */

typedef u64 efi_physical_addr_t;
typedef void *efi_handle_t;

include/linux/efi.h +3 -0
+#define efi_char16le_to_cpu le16_to_cpu
+#define efi_char16be_to_cpu be16_to_cpu
+

/*
* The UEFI spec and EDK2 reference implementation both define EFI_GUID as
* struct { u32 a; u16; b; u16 c; u8 d[8]; }; and so the implied alignment
--
2.17.1

#7 lore raw
In reply to Nikolai Merinov
Quoted 20 lines · Nikolai Merinov

GUID partition entry defined to have a partition name as 36 UTF-16LE code units. This means that on big-endian platforms ASCII symbols would be read with 0xXX00 efi_char16_t character code. In order to correctly extract ASCII characters from a partition name field we should be converted from 16LE to CPU architecture.

The problem exists on all big endian platforms.

---
 block/partitions/efi.c | 3 ++-
 block/partitions/efi.h | 2 +-
 include/linux/efi.h    | 5 +++++
 3 files changed, 8 insertions(+), 2 deletions(-)
block/partitions/efi.c +0 -0
index db2fef7dfc47..f1d0820de844 100644

block/partitions/efi.c int efi_partition(struct parsed_partitions *state) · line 719

Quoted 6 lines
block/partitions/efi.c +2 -1
@@ -715,7 +715,8 @@ int efi_partition(struct parsed_partitions *state)
 				ARRAY_SIZE(ptes[i].partition_name));
 		info->volname[label_max] = 0;
 		while (label_count < label_max) {
-			u8 c = ptes[i].partition_name[label_count] & 0xff;
+			u8 c = 0xff & efi_char16le_to_cpu(
+					ptes[i].partition_name[label_count]);

Why are you swapping the order of the comparism to an unusual one here?

Quoted 10 lines
block/partitions/efi.c +1 -1
-	efi_char16_t partition_name[72 / sizeof (efi_char16_t)];
+	efi_char16le_t partition_name[72 / sizeof(efi_char16le_t)];
 } __packed gpt_entry;
 

typedef struct _gpt_mbr_record {

include/linux/efi.h +0 -0
index aa54586db7a5..47882f2d45db 100644

include/linux/efi.h line 54

Quoted 10 lines
include/linux/efi.h +4 -0
@@ -45,9 +45,14 @@
 typedef unsigned long efi_status_t;
 typedef u8 efi_bool_t;
 typedef u16 efi_char16_t;		/* UNICODE character */
+typedef __le16 efi_char16le_t;		/* UTF16-LE */
+typedef __be16 efi_char16be_t;		/* UTF16-BE */
 typedef u64 efi_physical_addr_t;
 typedef void *efi_handle_t;
 
+#define efi_char16le_to_cpu le16_to_cpu
+#define efi_char16be_to_cpu be16_to_cpu

I'd rather use plain __le16 and le16_to_cpu here. Also the be variants seems to be entirely unused.

#8 lore raw

Hi Christoph,

Quoted 2 lines

I'd rather use plain __le16 and le16_to_cpu here. Also the be variants seems to be entirely unused.

Looks like I misunderstood your comment from https://patchwork.kernel.org/patch/11309223/:

Quoted 2 lines

Please add a an efi_char_from_cpu or similarly named helper to encapsulate this logic.

The "le16_to_cpu(ptes[i].partition_name[label_count])" call is the full implementation of the "efi_char_from_cpu" logic. Do you want to encapsulate "utf16_le_to_7bit_string" logic entirely like in the attached version?

Regards,
Nikolai

From 842cf22d6f6f91872bcb04ac6abe7794fede23fd Mon Sep 17 00:00:00 2001
From: Nikolai Merinov <[email protected]>
Date: Sat, 24 Nov 2018 20:42:27 +0500
Subject: [PATCH v4] partitions/efi: Fix partition name parsing in GUID
partition entry

GUID partition entry defined to have a partition name as 36 UTF-16LE code units. This means that on big-endian platforms ASCII symbols would be read with 0xXX00 efi_char16_t character code. In order to correctly extract ASCII characters from a partition name field we should be converted from 16LE to CPU architecture.

The problem exists on all big endian platforms.

Fixes eec7ecfede74 ("genhd, efi: add efi partition metadata to hd_structs")
---
 block/partitions/efi.c | 35 ++++++++++++++++++++++++++---------
 block/partitions/efi.h |  2 +-
 2 files changed, 27 insertions(+), 10 deletions(-)
block/partitions/efi.c +26 -9
index db2fef7dfc47..d26a0654d7ca 100644
@@ -656,6 +656,30 @@ static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt,
         return 0;
 }
 
+/**
+ * utf16_le_to_7bit(): Naively converts UTF-16LE string to 7bit characters
+ * @in: input UTF-16LE string
+ * @size: size of the input string
+ * @out: output string ptr, should be capable to store @size+1 characters
+ *
+ * Description: Converts @size UTF16-LE symbols from @in string to 7bit
+ * characters and store them to @out. Adds trailing zero to @out array.
+ */
+static void utf16_le_to_7bit(const __le16 *in, unsigned int size, u8 *out)
+{
+	unsigned int i = 0;
+
+	out[size] = 0;
+	while (i < size) {
+		u8 c = le16_to_cpu(in[i]) & 0xff;
+
+		if (c && !isprint(c))
+			c = '!';
+		out[i] = c;
+		i++;
+	}
+}
+
 /**
  * efi_partition(struct parsed_partitions *state)
  * @state: disk parsed partitions
@@ -692,7 +716,6 @@ int efi_partition(struct parsed_partitions *state)
 
 	for (i = 0; i < le32_to_cpu(gpt->num_partition_entries) && i < state->limit-1; i++) {
 		struct partition_meta_info *info;
-		unsigned label_count = 0;
 		unsigned label_max;
 		u64 start = le64_to_cpu(ptes[i].starting_lba);
 		u64 size = le64_to_cpu(ptes[i].ending_lba) -
@@ -713,14 +736,8 @@ int efi_partition(struct parsed_partitions *state)
 		/* Naively convert UTF16-LE to 7 bits. */
 		label_max = min(ARRAY_SIZE(info->volname) - 1,
 				ARRAY_SIZE(ptes[i].partition_name));
-		info->volname[label_max] = 0;
-		while (label_count < label_max) {
-			u8 c = ptes[i].partition_name[label_count] & 0xff;
-			if (c && !isprint(c))
-				c = '!';
-			info->volname[label_count] = c;
-			label_count++;
-		}
+		utf16_le_to_7bit(ptes[i].partition_name, label_max,
+				 info->volname);
 		state->parts[i + 1].has_info = true;
 	}
 	kfree(ptes);
block/partitions/efi.h +1 -1
index 3e8576157575..0b6d5b7be111 100644
@@ -88,7 +88,7 @@ typedef struct _gpt_entry {
 	__le64 starting_lba;
 	__le64 ending_lba;
 	gpt_entry_attributes attributes;
-	efi_char16_t partition_name[72 / sizeof (efi_char16_t)];
+	__le16 partition_name[72 / sizeof (__le16)];
 } __packed gpt_entry;
 
 typedef struct _gpt_mbr_record {
Signature · 1 line
2.17.1
Reviewed-by Christoph Hellwig
#9 lore raw
Quoted 7 lines · Nikolai Merinov

Hi Christoph,

Quoted 2 lines

I'd rather use plain __le16 and le16_to_cpu here. Also the be variants seems to be entirely unused.

Looks like I misunderstood your comment from https://patchwork.kernel.org/patch/11309223/:

Quoted 7 lines
Quoted 2 lines

Please add a an efi_char_from_cpu or similarly named helper to encapsulate this logic.

The "le16_to_cpu(ptes[i].partition_name[label_count])" call is the full implementation of the "efi_char_from_cpu" logic. Do you want to encapsulate "utf16_le_to_7bit_string" logic entirely like in the attached version?

I think I though of just the inner loop, but your new version looks even better, so:

#10 lore raw

Hi Christoph,

Should I perform any other steps in order to get this change in the master?

Regards,
Nikolai

----- Original Message -----

Quoted 29 lines

From: "hch" <[email protected]>
To: "n merinov" <[email protected]>
Cc: "hch" <[email protected]>, "Davidlohr Bueso" <[email protected]>, "Jens Axboe" <[email protected]>, "Ard Biesheuvel" <[email protected]>, "linux-efi" <[email protected]>, "linux-block" <[email protected]>, "linux-kernel" <[email protected]>
Sent: Monday, February 24, 2020 10:08:13 PM
Subject: Re: [PATCH v3] partitions/efi: Fix partition name parsing in GUID partition entry

Quoted 8 lines · Nikolai Merinov

Hi Christoph,

Quoted 2 lines

I'd rather use plain __le16 and le16_to_cpu here. Also the be variants seems to be entirely unused.

Looks like I misunderstood your comment from
https://patchwork.kernel.org/patch/11309223/:

Quoted 7 lines
Quoted 2 lines

Please add a an efi_char_from_cpu or similarly named helper to encapsulate this logic.

The "le16_to_cpu(ptes[i].partition_name[label_count])" call is the full implementation of the "efi_char_from_cpu" logic. Do you want to encapsulate "utf16_le_to_7bit_string" logic entirely like in the attached version?

I think I though of just the inner loop, but your new version looks even better, so:

maintainer
#11 lore raw
Quoted 5 lines · Nikolai Merinov

Hi Christoph,

Should I perform any other steps in order to get this change in the master?

I can take it via the EFI tree with an ack from Dave.

Quoted 31 lines

----- Original Message -----

Quoted 29 lines

From: "hch" <[email protected]>
To: "n merinov" <[email protected]>
Cc: "hch" <[email protected]>, "Davidlohr Bueso" <[email protected]>, "Jens Axboe" <[email protected]>, "Ard Biesheuvel" <[email protected]>, "linux-efi" <[email protected]>, "linux-block" <[email protected]>, "linux-kernel" <[email protected]>
Sent: Monday, February 24, 2020 10:08:13 PM
Subject: Re: [PATCH v3] partitions/efi: Fix partition name parsing in GUID partition entry

Quoted 8 lines · Nikolai Merinov

Hi Christoph,

Quoted 2 lines

I'd rather use plain __le16 and le16_to_cpu here. Also the be variants seems to be entirely unused.

Looks like I misunderstood your comment from
https://patchwork.kernel.org/patch/11309223/:

Quoted 7 lines
Quoted 2 lines

Please add a an efi_char_from_cpu or similarly named helper to encapsulate this logic.

The "le16_to_cpu(ptes[i].partition_name[label_count])" call is the full implementation of the "efi_char_from_cpu" logic. Do you want to encapsulate "utf16_le_to_7bit_string" logic entirely like in the attached version?

I think I though of just the inner loop, but your new version looks even better, so:

maintainer
#12 lore raw
Quoted 11 lines · Ard Biesheuvel
Quoted 5 lines · Nikolai Merinov

Hi Christoph,

Should I perform any other steps in order to get this change in the master?

I can take it via the EFI tree with an ack from Dave.

... or actually, I'm sure Dave is fine with it, so I'll just queue it in efi/next directly (with Christoph's ack)

Quoted 32 lines
Quoted 32 lines

----- Original Message -----

Quoted 29 lines

From: "hch" <[email protected]>
To: "n merinov" <[email protected]>
Cc: "hch" <[email protected]>, "Davidlohr Bueso" <[email protected]>, "Jens Axboe" <[email protected]>, "Ard Biesheuvel" <[email protected]>, "linux-efi" <[email protected]>, "linux-block" <[email protected]>, "linux-kernel" <[email protected]>
Sent: Monday, February 24, 2020 10:08:13 PM
Subject: Re: [PATCH v3] partitions/efi: Fix partition name parsing in GUID partition entry

Quoted 8 lines · Nikolai Merinov

Hi Christoph,

Quoted 2 lines

I'd rather use plain __le16 and le16_to_cpu here. Also the be variants seems to be entirely unused.

Looks like I misunderstood your comment from
https://patchwork.kernel.org/patch/11309223/:

Quoted 7 lines
Quoted 2 lines

Please add a an efi_char_from_cpu or similarly named helper to encapsulate this logic.

The "le16_to_cpu(ptes[i].partition_name[label_count])" call is the full implementation of the "efi_char_from_cpu" logic. Do you want to encapsulate "utf16_le_to_7bit_string" logic entirely like in the attached version?

I think I though of just the inner loop, but your new version looks even better, so: