From: David Laight <David.Laight@ACULAB.COM>
To: 'Davidlohr Bueso' <dave@stgolabs.net>,
Eugene Korenevsky <ekorenevsky@gmail.com>,
"linux-efi@vger.kernel.org" <linux-efi@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: RE: [PATCH v3] efi: take size of partition entry from GPT header
Date: Thu, 13 Sep 2018 13:25:07 +0000 [thread overview]
Message-ID: <c158b639852d48d382445d33da8c6a1e@AcuMS.aculab.com> (raw)
In-Reply-To: <20180912185517.GE3902@linux-r8p5>
From: Davidlohr Bueso
> Sent: 12 September 2018 19:55
>
> 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; i < le32_to_cpu(gpt->num_partition_entries) &&
> i < state->limit-1; i++)
Better still cache le32_to_cpu(gpt->num_partition_entries) to a local
so that it only has to be calculated once (even if it gets spilled
to the stack).
It can be bounded by state->limit-1 at the same time.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2018-09-13 13:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-12 18:35 Eugene Korenevsky
2018-09-12 18:55 ` Davidlohr Bueso
2018-09-13 13:25 ` David Laight [this message]
2018-09-13 19:44 ` Eugene Korenevsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c158b639852d48d382445d33da8c6a1e@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=ard.biesheuvel@linaro.org \
--cc=dave@stgolabs.net \
--cc=ekorenevsky@gmail.com \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®