Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp7385475ybl; Tue, 24 Dec 2019 01:24:18 -0800 (PST) X-Google-Smtp-Source: APXvYqyj4KevpSfXKhZbUZxH9DKiJLvnRORI3AASVCPse33Sq1JU+xSXE0T5J0vBbuTVhb8wzTk3 X-Received: by 2002:a05:6830:1595:: with SMTP id i21mr37950561otr.29.1577179458256; Tue, 24 Dec 2019 01:24:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577179458; cv=none; d=google.com; s=arc-20160816; b=LT7ZTGSEk17PqkmWAfCMHaZfVTLGtpgC38LFH8scQqNO1cqVhB4t89AZ+4HuSYuc0g KLB03vix0KtTGRwc73az0lJF5fKbK69hwB0BAd0Ht/Ze2nAtYuK2GOvZn8yDBa9rqYRW N1Gog9MJB8zIUKr1rm+5p0hNJLjGQfQokfQ/uOexcgGmy6eNgTROvPSPNEPk+nQiwJmY tcWbeDqmmGqNwL+wvR5tLziaeAcsTXdFV3bugxB6qdHb57YX/gq/4+vGQLJQc0i+uQ0W gWHqOSCK7R4SWR3QvFrYM2rv3sxrZoSebsRkngec9UnnIXj5OhnxfFkNIk9eQQE0kk+P qmEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=CAmI7apeyL7jZ6co+qwW6zsFPTjggPHOPX6bTaAoTBQ=; b=XTCYa6HUsD2FlfBvGQs2Kj/ZaTbwSDUwFgBtofkPWAv1839XUJtnJyi0GUY7cgWWBF aMhGAL6/v58CUfAffJ5zQRLsrtbDLEXjg9GZt2XbLiITXydW/Cp+5+N4Om6rVVUpU5F6 SJsHpCYRP5wQnUs1vrBV3D9yeWu+WB1EBLmfT3PeSrawnNlQhueyqQdcXhHkzg+Zd7hr rAHKUCWPhRyV2L9+9Svi64qujWzaP9PnLzxQwtpMlBxz4oyZIU6sEh/6e88OxDNSlzhn 5dXYpmFmzBupkDgwD2umZtcVoxlUNTsIWdf9KOTcl1bBR+GUBKq22cCuP99JXsET69PH pFaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@inango-systems.com header.s=45A440E0-D841-11E8-B985-5FCC721607E0 header.b="jYec26/e"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=inango-systems.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r202si10664986oie.247.2019.12.24.01.24.05; Tue, 24 Dec 2019 01:24:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@inango-systems.com header.s=45A440E0-D841-11E8-B985-5FCC721607E0 header.b="jYec26/e"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=inango-systems.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726184AbfLXJVb (ORCPT + 99 others); Tue, 24 Dec 2019 04:21:31 -0500 Received: from mail.inango-systems.com ([178.238.230.57]:37754 "EHLO mail.inango-sw.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726065AbfLXJVb (ORCPT ); Tue, 24 Dec 2019 04:21:31 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.inango-sw.com (Postfix) with ESMTP id 69B2A1080783; Tue, 24 Dec 2019 11:21:29 +0200 (IST) Received: from mail.inango-sw.com ([127.0.0.1]) by localhost (mail.inango-sw.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 1fxzy3dGzunS; Tue, 24 Dec 2019 11:21:28 +0200 (IST) Received: from localhost (localhost [127.0.0.1]) by mail.inango-sw.com (Postfix) with ESMTP id DE3D9108078E; Tue, 24 Dec 2019 11:21:28 +0200 (IST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.inango-sw.com DE3D9108078E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inango-systems.com; s=45A440E0-D841-11E8-B985-5FCC721607E0; t=1577179288; bh=CAmI7apeyL7jZ6co+qwW6zsFPTjggPHOPX6bTaAoTBQ=; h=From:To:Date:Message-Id; b=jYec26/eP5rkBjgKag80Q62vw95TEj1y+Cs11iTw2xYKxUdpAqnI1mkOqARJm/YFL JOwhfcR7m56oX2R0jCchrumekxx2qvoRS/D3Yb2qsKSR+r/AWquos/6GhLVv7xbLT+ 3cbi4gPunzbfWPZTPi3s4UN31yBoWaC9DH5e0PhslvdmNH7EZw7JwQcYO7Pnq+KhQe PB6BbYt6+i66zx9XL6vVMxLmzdKR6k4aPwAAvdEGJkAySQfQ1N1HF3GuQYRVw+PVna mDN8Et9jKR6+LGkc51+HBgXuHHqW7tCJz8fwyjBPSL5BeHf4C7PKbEmqd0FevXMUuG Bl+UamaTZxy9A== X-Virus-Scanned: amavisd-new at inango-sw.com Received: from mail.inango-sw.com ([127.0.0.1]) by localhost (mail.inango-sw.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id VoL7VamDXbEy; Tue, 24 Dec 2019 11:21:28 +0200 (IST) Received: from nmerinov.inango.loc (unknown [194.60.247.123]) by mail.inango-sw.com (Postfix) with ESMTPSA id 22D7B108023C; Tue, 24 Dec 2019 11:21:28 +0200 (IST) From: Nikolai Merinov To: Davidlohr Bueso , Jens Axboe , linux-efi@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Nikolai Merinov Subject: [PATCH v2] partitions/efi: Fix partition name parsing in GUID partition entry Date: Tue, 24 Dec 2019 14:21:19 +0500 Message-Id: <20191224092119.4581-1-n.merinov@inango-systems.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181124162123.21300-1-n.merinov@inango-systems.com> References: <20181124162123.21300-1-n.merinov@inango-systems.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 diff --git a/block/partitions/efi.c b/block/partitions/efi.c index db2fef7dfc47..51287a8a3bea 100644 --- a/block/partitions/efi.c +++ b/block/partitions/efi.c @@ -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; diff --git a/block/partitions/efi.h b/block/partitions/efi.h index 3e8576157575..0b6d5b7be111 100644 --- a/block/partitions/efi.h +++ b/block/partitions/efi.h @@ -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