lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c158b639852d48d382445d33da8c6a1e@AcuMS.aculab.com>
Date:   Thu, 13 Sep 2018 13:25:07 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Davidlohr Bueso' <dave@...olabs.net>,
        Eugene Korenevsky <ekorenevsky@...il.com>,
        "linux-efi@...r.kernel.org" <linux-efi@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Ard Biesheuvel <ard.biesheuvel@...aro.org>
Subject: RE: [PATCH v3] efi: take size of partition entry from GPT header

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)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ