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]
Date:   Wed, 12 Sep 2018 11:55:17 -0700
From:   Davidlohr Bueso <dave@...olabs.net>
To:     Eugene Korenevsky <ekorenevsky@...il.com>,
        linux-efi@...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

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ