lkml.org 
[lkml]   [2018]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] partitions/efi: Fix partition name parsing in GUID partition entry
Date
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
\
 
 \ /
  Last update: 2018-11-24 17:31    [W:0.079 / U:1.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site