[U-Boot,2/7] omap_hsmmc: fix out of bounds array access

Message ID 1354537187-26744-3-git-send-email-nikita@compulab.co.il
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Nikita Kiryanov Dec. 3, 2012, 12:19 p.m.
There are 3 MMC/SD/SDIO controllers in OMAP SoCs, but only 2 structs
are defined for devices. This leads to data being written outside of
array bounds on systems that use all 3 controllers.

Update hsmmc_dev array to the correct size.

Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
 drivers/mmc/omap_hsmmc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
index afd9b30..23dcebd 100644
--- a/drivers/mmc/omap_hsmmc.c
+++ b/drivers/mmc/omap_hsmmc.c
@@ -44,7 +44,7 @@ 
 static int mmc_read_data(struct hsmmc *mmc_base, char *buf, unsigned int size);
 static int mmc_write_data(struct hsmmc *mmc_base, const char *buf,
 			unsigned int siz);
-static struct mmc hsmmc_dev[2];
+static struct mmc hsmmc_dev[3];
 #if defined(CONFIG_OMAP44XX) && defined(CONFIG_TWL6030_POWER)
 static void omap4_vmmc_pbias_config(struct mmc *mmc)