linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] partitions/efi: Fix partition name parsing in GUID partition entry
@ 2018-11-24 16:21 Nikolai Merinov
  2018-11-25 21:16 ` kbuild test robot
  2019-12-24  9:21 ` [PATCH v2] " Nikolai Merinov
  0 siblings, 2 replies; 13+ messages in thread
From: Nikolai Merinov @ 2018-11-24 16:21 UTC (permalink / raw)
  To: Davidlohr Bueso, linux-efi
  Cc: Jens Axboe, linux-block, linux-kernel, 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.

Signed-off-by: Nikolai Merinov <n.merinov@inango-systems.com>
---
 block/partitions/efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/partitions/efi.c b/block/partitions/efi.c
index 39f70d968754..ea50ee1505ed 100644
--- a/block/partitions/efi.c
+++ b/block/partitions/efi.c
@@ -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;
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-03-06 10:14 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-24 16:21 [PATCH] partitions/efi: Fix partition name parsing in GUID partition entry Nikolai Merinov
2018-11-25 21:16 ` kbuild test robot
2019-12-24  9:21 ` [PATCH v2] " Nikolai Merinov
2019-12-24  9:51   ` Ard Biesheuvel
2020-01-08 13:39   ` Christoph Hellwig
2020-01-13 10:27     ` [PATCH v3] " Nikolai Merinov
2020-02-18 13:34       ` Nikolai Merinov
2020-02-18 18:53       ` Christoph Hellwig
2020-02-24 11:38         ` Nikolai Merinov
2020-02-24 17:08           ` hch
2020-03-06  8:43             ` Nikolai Merinov
2020-03-06  9:25               ` Ard Biesheuvel
2020-03-06 10:14                 ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).