mmc: mv_sdhci: zero out sdhci_host structure
PATCH 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, 2 insertions(+)
drivers/mmc/mv_sdhci.c +2 -0
@@ -74,6 +74,8 @@ int mv_sdh_init(unsigned long regbase, u32 max_clk, u32 min_clk, u32 quirks)return -ENOMEM ; } +memset (host,0 ,sizeof (struct sdhci_host )); + host->name =MVSDH_NAME ; host->ioaddr = (void *)regbase; host->quirks = quirks;
Signature · 1 line
2.14.3
PATCH 1/1 mmc: mv_sdhci: zero out sdhci_host structure
Hi Matt,
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, 2 insertions(+)drivers/mmc/mv_sdhci.c +0
-0
drivers/mmc/mv_sdhci.c int mv_sdh_init(unsigned long regbase, u32 max_clk, u32 min_clk, u32 quirks) · line 81
Quoted 8 lines
drivers/mmc/mv_sdhci.c +2
-0@@ -74,6 +74,8 @@ int mv_sdh_init(unsigned long regbase, u32 max_clk, u32 min_clk, u32 quirks)return -ENOMEM ; } +memset (host,0 ,sizeof (struct sdhci_host )); + host->name =MVSDH_NAME ; host->ioaddr = (void *)regbase; host->quirks = quirks;
Thanks for finding this. But please use calloc() instead of malloc() and the memset can be dropped.
Thanks,
Stefan
PATCH 1/1 mmc: mv_sdhci: zero out sdhci_host structure
Quoted 21 lines · Stefan Roese
Hi Matt,
Quoted 18 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, 2 insertions(+)drivers/mmc/mv_sdhci.c +1
-0@@ -74,6 +74,8 @@ int mv_sdh_init(unsigned long regbase, u32 max_clk, u32 min_clk, u32 quirks) return -ENOMEM; } + memset(host, 0, sizeof(struct sdhci_host));
Quoted 8 lines
drivers/mmc/mv_sdhci.c int mv_sdh_init(unsigned long regbase, u32 max_clk, u32 min_clk, u32 quirks) · line 81
Quoted 5 lines
drivers/mmc/mv_sdhci.c +1
-0+ host->name = MVSDH_NAME; host->ioaddr = (void *)regbase; host->quirks = quirks;Thanks for finding this. But please use
calloc()instead ofmalloc()and the memset can be dropped.
Any chance for a respin of v2 with calloc() soon (for the upcoming release)?
Thanks,
Stefan