Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5839041imm; Wed, 12 Sep 2018 11:57:31 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZOMTpDqN5rZDZCNiUvgYupNHFUdpK+xJK5zxEmrqZa7KNalqdlnI1Vwok91yzzeSYjMxj3 X-Received: by 2002:a63:f849:: with SMTP id v9-v6mr3760608pgj.71.1536778651354; Wed, 12 Sep 2018 11:57:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536778651; cv=none; d=google.com; s=arc-20160816; b=FQoBe8zlhGVOztncEsjsvn5eepwDJLz6ZFQqMqzPTbv7kFC/qROF/jE8dW3QqDyMT3 bzZOnk0Kp8Oe+RKWmMkfOgAATftZ1Q3xuxh22Fmji+G0yCe0KIyqJoqc3ZERuwSREJnz nK4SMpHEbuGffYT5e62fOCPErLEiPqVu6CH96BWgoQDwV51Hzr7BPIYGcgdAnTAZLseJ TknHQp3o9JbGSZNJUT1wlUxDN26r68LB+ZZr7ivRqrN6N6EFMRCJoH3FOPt0NE+guakA vThSx1Bh5BSMBBoRlO15XlDmc9WjCzCcY2l9zPZJsEUp7O6B0x+CDRKmoE6s0CZehLC8 O+uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:to :from:date; bh=L7N0zNToWOkXUevkrdeyKEpGMqnByet2r6dqQAyRxoY=; b=PY4OS1q6MtW3rk2ODqYUM8jUGMhiBDBczJeJrkeufrjSb8YaShxHVPchO8bHet56PF R1rAwXmt6b3WXH/TlYLCH3ewdK6Jo9GiAUwkovIwHde+JuWRbVPb/pemhS1VVkh2ZKXz MeNfo45M9EK0KK57XVztwI5aak/unLNKtpJbYTrA6oSfHesV+JN24CLADd6Fz7bRv6ju 4yEAM+JQYFhr3VI9uCpO/uzHnmi0f6B5Mg6M7lzuSOrOCEbMoZCGCr5dfLxZlPxyDnWP H8MFdh3G+eZD/ak/GbxNUIYl6ghuYvTBuRttvYKFdQf+8xq8wwHvBzjlO3pXcTB5IO03 7Yaw== 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 3-v6si1763095plu.65.2018.09.12.11.57.16; Wed, 12 Sep 2018 11:57:31 -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 S1728048AbeIMABS (ORCPT + 99 others); Wed, 12 Sep 2018 20:01:18 -0400 Received: from mx2.suse.de ([195.135.220.15]:56634 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727047AbeIMABS (ORCPT ); Wed, 12 Sep 2018 20:01:18 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id F1ECFACD1; Wed, 12 Sep 2018 18:55:25 +0000 (UTC) Date: Wed, 12 Sep 2018 11:55:17 -0700 From: Davidlohr Bueso To: Eugene Korenevsky , linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, Ard Biesheuvel Subject: Re: [PATCH v3] efi: take size of partition entry from GPT header Message-ID: <20180912185517.GE3902@linux-r8p5> References: <20180912183519.GA31506@vnote> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20180912183519.GA31506@vnote> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 12 Sep 2018, Eugene Korenevsky wrote: > /** > * efi_partition(struct parsed_partitions *state) > * @state: disk parsed partitions >@@ -704,32 +710,36 @@ int efi_partition(struct parsed_partitions *state) > > pr_debug("GUID Partition Table is valid! Yea!\n"); > >- for (i = 0; i < le32_to_cpu(gpt->num_partition_entries) && i < state->limit-1; i++) { >+ for (i = 0; >+ i < le32_to_cpu(gpt->num_partition_entries) && i < state->limit-1; >+ i++) { Please rearrange this like: for (i = 0; < le32_to_cpu(gpt->num_partition_entries) && i < state->limit-1; i++) >+ gpt_entry *pte = get_gpt_entry(gpt, ptes, i); > struct partition_meta_info *info; > unsigned label_count = 0; > unsigned label_max; >- u64 start = le64_to_cpu(ptes[i].starting_lba); >- u64 size = le64_to_cpu(ptes[i].ending_lba) - >- le64_to_cpu(ptes[i].starting_lba) + 1ULL; >+ u64 start = le64_to_cpu(pte->starting_lba); >+ u64 size = le64_to_cpu(pte->ending_lba) - >+ le64_to_cpu(pte->starting_lba) + 1ULL; > >- if (!is_pte_valid(&ptes[i], last_lba(state->bdev))) >+ if (!is_pte_valid(pte, last_lba(state->bdev))) > continue; > > put_partition(state, i+1, start * ssz, size * ssz); > > /* If this is a RAID volume, tell md */ >- if (!efi_guidcmp(ptes[i].partition_type_guid, PARTITION_LINUX_RAID_GUID)) >+ if (!efi_guidcmp( >+ pte->partition_type_guid, PARTITION_LINUX_RAID_GUID)) This is ugly. If you are worried about 80-chars, please do: if (!efi_guidcmp(pte->partition_type_guid, PARTITION_LINUX_RAID_GUID)) Thanks, Davidlohr