>From 0bae0df23bbc4a9e98f1bcac6c6fbe0c3b21bc78 Mon Sep 17 00:00:00 2001
From: Florian Otte <fotte@uos.de>
Date: Mon, 2 Sep 2024 11:27:47 +0200
Subject: [PATCH] FIX: buffer overflow on MCI-partition enumeration

Memory for up to 6 partitions is reserved, however there can be up to 7
partitions on an mci storage (e.g. emmc). A user partition two boot partitions
and up to four general pupose partitions.
---
 include/mci.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/mci.h b/include/mci.h
index 3bf1455a40..cd01e2f992 100644
--- a/include/mci.h
+++ b/include/mci.h
@@ -600,7 +600,10 @@ struct mci_host {
 
 #define MMC_NUM_BOOT_PARTITION	2
 #define MMC_NUM_GP_PARTITION	4
-#define MMC_NUM_PHY_PARTITION	6
+#define MMC_NUM_USER_PARTITION	1
+#define MMC_NUM_PHY_PARTITION	(MMC_NUM_BOOT_PARTITION + \
+                                 MMC_NUM_GP_PARTITION + \
+                                 MMC_NUM_USER_PARTITION)
 
 struct mci_part {
 	struct block_device	blk;		/**< the blockdevice for the card */
-- 
2.39.2


