All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] mmc: mv_sdhci: zero out sdhci_host structure
@ 2018-03-27 17:53 Matt Pelland
  2018-04-12 10:24 ` Stefan Roese
  0 siblings, 1 reply; 3+ messages in thread
From: Matt Pelland @ 2018-03-27 17:53 UTC (permalink / raw)
  To: u-boot

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.

Signed-off-by: Matt Pelland <mpelland@starry.com>
---
 drivers/mmc/mv_sdhci.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mmc/mv_sdhci.c b/drivers/mmc/mv_sdhci.c
index 69aa87babe..afc03f75a0 100644
--- a/drivers/mmc/mv_sdhci.c
+++ b/drivers/mmc/mv_sdhci.c
@@ -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;
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] mmc: mv_sdhci: zero out sdhci_host structure
  2018-03-27 17:53 [U-Boot] [PATCH] mmc: mv_sdhci: zero out sdhci_host structure Matt Pelland
@ 2018-04-12 10:24 ` Stefan Roese
  2018-04-16  7:54   ` Stefan Roese
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Roese @ 2018-04-12 10:24 UTC (permalink / raw)
  To: u-boot

Hi Matt,

On 27.03.2018 19:53, Matt Pelland wrote:
> 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.
> 
> Signed-off-by: Matt Pelland <mpelland@starry.com>
> ---
>   drivers/mmc/mv_sdhci.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/mmc/mv_sdhci.c b/drivers/mmc/mv_sdhci.c
> index 69aa87babe..afc03f75a0 100644
> --- a/drivers/mmc/mv_sdhci.c
> +++ b/drivers/mmc/mv_sdhci.c
> @@ -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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] mmc: mv_sdhci: zero out sdhci_host structure
  2018-04-12 10:24 ` Stefan Roese
@ 2018-04-16  7:54   ` Stefan Roese
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Roese @ 2018-04-16  7:54 UTC (permalink / raw)
  To: u-boot

On 12.04.2018 12:24, Stefan Roese wrote:
> Hi Matt,
> 
> On 27.03.2018 19:53, Matt Pelland wrote:
>> 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.
>>
>> Signed-off-by: Matt Pelland <mpelland@starry.com>
>> ---
>>   drivers/mmc/mv_sdhci.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/mmc/mv_sdhci.c b/drivers/mmc/mv_sdhci.c
>> index 69aa87babe..afc03f75a0 100644
>> --- a/drivers/mmc/mv_sdhci.c
>> +++ b/drivers/mmc/mv_sdhci.c
>> @@ -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.

Any chance for a respin of v2 with calloc() soon (for the upcoming
release)?

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-04-16  7:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-27 17:53 [U-Boot] [PATCH] mmc: mv_sdhci: zero out sdhci_host structure Matt Pelland
2018-04-12 10:24 ` Stefan Roese
2018-04-16  7:54   ` Stefan Roese

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.