diff mbox series

[1/1] cmd: part: list all 128 GPT partitions

Message ID 20220111150820.490822-1-heinrich.schuchardt@canonical.com
State Accepted
Commit bc314f8e5f9b646e5ed09ccee2a2ddb012519305
Delegated to: Tom Rini
Headers show
Series [1/1] cmd: part: list all 128 GPT partitions | expand

Commit Message

Heinrich Schuchardt Jan. 11, 2022, 3:08 p.m. UTC
A GPT partition table typically has 128 entries. If a partition table
contains a partition 128 'part list' should be able to list it.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 cmd/part.c     | 4 ++--
 include/part.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/cmd/part.c b/cmd/part.c
index e0463b5a54..9d419c967c 100644
--- a/cmd/part.c
+++ b/cmd/part.c
@@ -89,10 +89,10 @@  static int do_part_list(int argc, char *const argv[])
 
 	if (var != NULL) {
 		int p;
-		char str[512] = { '\0', };
+		char str[3 * MAX_SEARCH_PARTITIONS] = { '\0', };
 		struct disk_partition info;
 
-		for (p = 1; p < MAX_SEARCH_PARTITIONS; p++) {
+		for (p = 1; p <= MAX_SEARCH_PARTITIONS; p++) {
 			char t[5];
 			int r = part_get_info(desc, p, &info);
 
diff --git a/include/part.h b/include/part.h
index b66b07a1f0..b8d8e1ff0d 100644
--- a/include/part.h
+++ b/include/part.h
@@ -50,7 +50,7 @@  struct block_drvr {
 
 #define PART_NAME_LEN 32
 #define PART_TYPE_LEN 32
-#define MAX_SEARCH_PARTITIONS 64
+#define MAX_SEARCH_PARTITIONS 128
 
 #define PART_BOOTABLE			((int)BIT(0))
 #define PART_EFI_SYSTEM_PARTITION	((int)BIT(1))