diff mbox series

[1/1] disk: gpt: print all partitions

Message ID 20220111144818.486952-1-heinrich.schuchardt@canonical.com
State Accepted
Commit 504dbd224a5fd4f80b785e17c106ea738cd32cb4
Delegated to: Tom Rini
Headers show
Series [1/1] disk: gpt: print all partitions | expand

Commit Message

Heinrich Schuchardt Jan. 11, 2022, 2:48 p.m. UTC
For GPT partition tables the 'part list' command stops at the first invalid
partition number. But Ubuntu has images with partitions number

    1, 12, 13, 14, 15

In this case only partition 1 was listed by 'part list'.

Fixes: 38a3021edc54 ("disk: part_efi: remove indent level from loop")
Reported-by: Alexandre Ghiti <alexandre.ghiti@canonical.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 disk/part_efi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Alexandre Ghiti Jan. 14, 2022, 9:40 a.m. UTC | #1
Hi Heinrich,

On Tue, Jan 11, 2022 at 3:48 PM Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> For GPT partition tables the 'part list' command stops at the first invalid
> partition number. But Ubuntu has images with partitions number
>
>     1, 12, 13, 14, 15
>
> In this case only partition 1 was listed by 'part list'.
>
> Fixes: 38a3021edc54 ("disk: part_efi: remove indent level from loop")
> Reported-by: Alexandre Ghiti <alexandre.ghiti@canonical.com>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  disk/part_efi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/disk/part_efi.c b/disk/part_efi.c
> index 0ca7effc32..3809333078 100644
> --- a/disk/part_efi.c
> +++ b/disk/part_efi.c
> @@ -236,9 +236,9 @@ void part_print_efi(struct blk_desc *dev_desc)
>         printf("\tPartition GUID\n");
>
>         for (i = 0; i < le32_to_cpu(gpt_head->num_partition_entries); i++) {
> -               /* Stop at the first non valid PTE */
> +               /* Skip invalid PTE */
>                 if (!is_pte_valid(&gpt_pte[i]))
> -                       break;
> +                       continue;
>
>                 printf("%3d\t0x%08llx\t0x%08llx\t\"%s\"\n", (i + 1),
>                         le64_to_cpu(gpt_pte[i].starting_lba),
> --
> 2.33.1
>

This works great for me, you can add:

Tested-by: Alexandre Ghiti <alexandre.ghiti@canonical.com>

Thanks!

Alex
diff mbox series

Patch

diff --git a/disk/part_efi.c b/disk/part_efi.c
index 0ca7effc32..3809333078 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -236,9 +236,9 @@  void part_print_efi(struct blk_desc *dev_desc)
 	printf("\tPartition GUID\n");
 
 	for (i = 0; i < le32_to_cpu(gpt_head->num_partition_entries); i++) {
-		/* Stop at the first non valid PTE */
+		/* Skip invalid PTE */
 		if (!is_pte_valid(&gpt_pte[i]))
-			break;
+			continue;
 
 		printf("%3d\t0x%08llx\t0x%08llx\t\"%s\"\n", (i + 1),
 			le64_to_cpu(gpt_pte[i].starting_lba),