platform: msm_shared: Fix max number of partition table entries

Max number of partition table entries is defined to 32, but the
gpt/mbr spec does not have any hard limit on the max entries.
Increase the max value to a safer number to 128.

CRs-Fixed: 551703
Change-Id: I93c9e98f3efb8fa85f99225e944ae86f834f7b5a
diff --git a/platform/msm_shared/include/partition_parser.h b/platform/msm_shared/include/partition_parser.h
index 25a73ca..bbd8422 100644
--- a/platform/msm_shared/include/partition_parser.h
+++ b/platform/msm_shared/include/partition_parser.h
@@ -72,7 +72,7 @@
 #define MAX_GPT_NAME_SIZE          72
 #define PARTITION_TYPE_GUID_SIZE   16
 #define UNIQUE_PARTITION_GUID_SIZE 16
-#define NUM_PARTITIONS             32
+#define NUM_PARTITIONS             128
 
 /* Some useful define used to access the MBR/EBR table */
 #define BLOCK_SIZE                0x200
diff --git a/platform/msm_shared/partition_parser.c b/platform/msm_shared/partition_parser.c
index e2d548e..6facb93 100644
--- a/platform/msm_shared/partition_parser.c
+++ b/platform/msm_shared/partition_parser.c
@@ -58,7 +58,7 @@
 unsigned int ext3_count = 0;
 unsigned int vfat_count = 0;
 
-struct partition_entry partition_entries[NUM_PARTITIONS];
+struct partition_entry *partition_entries;
 static unsigned gpt_partitions_exist = 0;
 unsigned partition_count = 0;
 
@@ -69,6 +69,10 @@
 
 	block_size = mmc_get_device_blocksize();
 
+	/* Allocate partition entries array */
+	partition_entries = (struct partition_entry *) calloc(NUM_PARTITIONS, sizeof(struct partition_entry));
+	ASSERT(partition_entries);
+
 	/* Read MBR of the card */
 	ret = mmc_boot_read_mbr(block_size);
 	if (ret) {