Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp666819imm; Thu, 13 Sep 2018 06:04:30 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaanE166rHhKMteethX8FMXkJtJoM9KqT7usolSqKFI9ykn2DVosP1W/JDiPCSINFENB1JW X-Received: by 2002:a17:902:1c5:: with SMTP id b63-v6mr7354233plb.82.1536843870084; Thu, 13 Sep 2018 06:04:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536843870; cv=none; d=google.com; s=arc-20160816; b=NdSb6E81NZiG75OVb0lx8aJvAHdiFP9mldiQHn0WM0Aw0y8nsJugD3j00vvzdQ9INg 0FROzlDZFUpAyAD8hAlNcOf9s0gJaYq6uPe4ikD4cyO7u6RJRDpoo0Q+FS8UkgcJKGEN 1/3Lxje9yCWmZimD5rdrkJhzYmSqtbWaa0flu2mcCVe3Zqv/H3ARbvJqAUZWWdFRZ/Sd ckMA4Auy1Xp2P/zBJmwvfPX5zWNigFNVNoIt7ql+NuLpmg/qywGUHgdtKndAeLe7TXo+ GVOdnvuPnt/eUYEnQy4EdCZuAHhLfOSiDJdrXwRP8CtXbCVCt6W1a8igCGWHcStLc2lS 8k1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:to:from; bh=4KwVRpAjjFcGFrrYeYYF9ajWqVcU49j0RQn197WTvQM=; b=LdWxuGX7JBn7j0lbGJzDNLodlKEeu6f8QpgvfMg0BsU9xtJXQb4iKUARRgMIduN2la my1UpkJrRnrFjeoPGZwftEtyLbRrGMuZ+x2odoAqVKtFHmMjQX3yBSLORgzYzM4L28VW U48vpNwb+CxJNWdQkoJVNtpQ3lXC6AT9ca+zwabFAEl4saSx+3jNuWE3uyAJCi+dLC4p ywKW56khiwyQK3MKY9dQCAU4aK8JGUpkL9ZdJ1ItJ/UNWtNi5g5aAWbp6RNWNMFtieR7 WHpw2EPtGrOJ3ROrLrTenSOxw947ErNDfLriIwrWtUqhGyUw6/haNsbedvQMwCaPJzLo r//A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f89-v6si3867986plf.20.2018.09.13.06.04.13; Thu, 13 Sep 2018 06:04:30 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727534AbeIMSN3 convert rfc822-to-8bit (ORCPT + 99 others); Thu, 13 Sep 2018 14:13:29 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([146.101.78.151]:58374 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726930AbeIMSN3 (ORCPT ); Thu, 13 Sep 2018 14:13:29 -0400 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-53-eHCeEkkZNIq8e6X4YDs0EA-1; Thu, 13 Sep 2018 14:04:03 +0100 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Thu, 13 Sep 2018 14:06:14 +0100 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Thu, 13 Sep 2018 14:06:13 +0100 From: David Laight To: 'Karel Zak' , Eugene Korenevsky , Davidlohr Bueso , "linux-efi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Ard Biesheuvel Subject: RE: [PATCH v2] efi: take size of partition entry from GPT header Thread-Topic: [PATCH v2] efi: take size of partition entry from GPT header Thread-Index: AQHUSnRba9AUJIT+vUG+D13HDhLQCKTuLuRw Date: Thu, 13 Sep 2018 13:06:13 +0000 Message-ID: <6d349d22d37041c1a2942d8ed4c76b69@AcuMS.aculab.com> References: <20180911161527.GA30689@vnote> <20180912083844.iegei2kobcz4b7ag@ws.net.home> In-Reply-To: <20180912083844.iegei2kobcz4b7ag@ws.net.home> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-MC-Unique: eHCeEkkZNIq8e6X4YDs0EA-1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Karel Zak > Sent: 12 September 2018 09:39 > On Tue, Sep 11, 2018 at 07:15:27PM +0300, Eugene Korenevsky wrote: > > +static gpt_entry *get_gpt_entry(gpt_header *gpt_hdr, gpt_entry *ptes, u32 index) > > +{ > > + return (gpt_entry *)((u8 *)ptes + gpt->sizeof_partition_entry * index); > > I guess header use LE, so you need: > > le32_to_cpu(gpt_hdr->sizeof_partition_entry) I suspect you also need a sanity check that the value isn't too small or stupidly large. In principle slightly short lengths presumably imply that the disk was formatted with an older standard - so the last fields should be ignored. They may not be any such disks - until the on-disk structure is extended and the kernel structure updated to match. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)