mmc: mv_sdhci: zero out sdhci_host structure
PATCH v2 1/1 mmc: mv_sdhci: zero out sdhci_host structure
The mv_sdhci driver was not zeroing the sdhci_host structure it allocates causing random access violations in parts of the mmc core where the "ops" member pointers are checked and called if not NULL.
--- drivers/mmc/mv_sdhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/mv_sdhci.c +1 -1
@@ -68,7 +68,7 @@ static char *MVSDH_NAME = "mv_sdh";int mv_sdh_init (unsigned long regbase,u32 max_clk,u32 min_clk,u32 quirks) {struct sdhci_host *host =NULL ; - host = (struct sdhci_host *)malloc (sizeof (struct sdhci_host )); + host =calloc (1 ,sizeof (*host));if (!host) {printf ("sdh_host malloc fail!\n" );return -ENOMEM ;
Signature · 1 line
2.14.3
PATCH v2 1/1 mmc: mv_sdhci: zero out sdhci_host structure
Quoted 15 lines · Matt Pelland
The
mv_sdhcidriver was not zeroing thesdhci_hoststructure it allocates causing random access violations in parts of the mmc core where the "ops" member pointers are checked and called if not NULL.Signed-off-by Matt Pelland <[email protected]>--- drivers/mmc/mv_sdhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/mmc/mv_sdhci.c +0
-0
drivers/mmc/mv_sdhci.c static char *MVSDH_NAME = "mv_sdh"; · line 74
Quoted 8 lines
drivers/mmc/mv_sdhci.c +1
-1@@ -68,7 +68,7 @@ static char *MVSDH_NAME = "mv_sdh";int mv_sdh_init (unsigned long regbase,u32 max_clk,u32 min_clk,u32 quirks) {struct sdhci_host *host =NULL ; - host = (struct sdhci_host *)malloc (sizeof (struct sdhci_host )); + host =calloc (1 ,sizeof (*host));if (!host) {printf ("sdh_host malloc fail!\n" );return -ENOMEM ;
Looks good, so:
Thanks,
Stefan
PATCH v2 1/1 mmc: mv_sdhci: zero out sdhci_host structure
Quoted 28 lines · Stefan Roese
Quoted 15 lines · Matt Pelland
The
mv_sdhcidriver was not zeroing thesdhci_hoststructure it allocates causing random access violations in parts of the mmc core where the "ops" member pointers are checked and called if not NULL.Signed-off-by Matt Pelland <[email protected]>---
drivers/mmc/mv_sdhci.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/mmc/mv_sdhci.c +0
-0@@ -68,7 +68,7 @@ static char *MVSDH_NAME = "mv_sdh";int mv_sdh_init(unsigned long regbase, u32
max_clk, u32min_clk, u32Quoted 9 lines
quirks)
{
structsdhci_host*host = NULL;
- host = (structsdhci_host*)malloc(sizeof(structsdhci_host)); + host =calloc(1, sizeof(*host));
if (!host) {
printf("sdh_host malloc fail!\n");
return-ENOMEM;Looks good, so:
Quoted 1 line
Reviewed-by Stefan Roese <[email protected]>
Applied to u-boot-marvell/master.
Thanks,
Stefan