From patchwork Sat Nov 24 16:21:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolai Merinov X-Patchwork-Id: 10696555 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 410901750 for ; Sat, 24 Nov 2018 16:30:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 245642A2D4 for ; Sat, 24 Nov 2018 16:30:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 17EE72A2E2; Sat, 24 Nov 2018 16:30:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C04E42A2D4 for ; Sat, 24 Nov 2018 16:30:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725774AbeKYDTJ (ORCPT ); Sat, 24 Nov 2018 22:19:09 -0500 Received: from mail.inango-systems.com ([213.136.71.184]:51990 "EHLO mail.inango-sw.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725880AbeKYDTJ (ORCPT ); Sat, 24 Nov 2018 22:19:09 -0500 X-Greylist: delayed 532 seconds by postgrey-1.27 at vger.kernel.org; Sat, 24 Nov 2018 22:19:07 EST Received: from localhost (localhost [127.0.0.1]) by mail.inango-sw.com (Postfix) with ESMTP id 34B577A24A7; Sat, 24 Nov 2018 18: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 nnfdl-_ejBLE; Sat, 24 Nov 2018 18:21:27 +0200 (IST) Received: from localhost (localhost [127.0.0.1]) by mail.inango-sw.com (Postfix) with ESMTP id EE8ED7A24A5; Sat, 24 Nov 2018 18:21:26 +0200 (IST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.inango-sw.com EE8ED7A24A5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inango-systems.com; s=45A440E0-D841-11E8-B985-5FCC721607E0; t=1543076487; bh=4yLHC0a37elTXzfbrjGdwZ41TXsia2MH0pMK8GMeZfY=; h=From:To:Date:Message-Id; b=IekxqYG0XLzmTNOrhfn9r29XU+ZdKcfR8jtBRz65Fr9YRIBvfbakCMO39174xPepD YZKDURhToT3wtiLCEi3V4LAbdYmRaDMRUaOWirRHwnRwBocth10oA9hJcgfQ5mdG6E 1JOJFVyCSxR9SjGbxED2sc0ufok7MyzGhjfO4mk6RWmU+cpHtLVLXM+WtgtCIokfrc BTElWs3kRe4NOO2gMUuQzCRK2pd0kHC/OcForfsmi8Sg42ctgBxOsXXXcGT0Ozg2s8 d8KHuzFDPL/UOtuvuTlIKbvV9HxZ+nO0BnW6c/mPdPhmQy3JZyZr9mMhAZM7beokcd XVHH+36YFcYqQ== 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 IkxIpi0nwRfy; Sat, 24 Nov 2018 18:21:26 +0200 (IST) Received: from nmerinov.inango-sw (unknown [194.60.247.123]) by mail.inango-sw.com (Postfix) with ESMTPSA id 00C317A24A4; Sat, 24 Nov 2018 18:21:25 +0200 (IST) From: Nikolai Merinov To: Davidlohr Bueso , linux-efi@vger.kernel.org Cc: Jens Axboe , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Nikolai Merinov Subject: [PATCH] partitions/efi: Fix partition name parsing in GUID partition entry Date: Sat, 24 Nov 2018 21:21:23 +0500 Message-Id: <20181124162123.21300-1-n.merinov@inango-systems.com> X-Mailer: git-send-email 2.14.1 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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;