[PATCH 2/4] mmc: sandbox: Initialize backing buffer

Jaehoon Chung jh80.chung at gmail.com
Fri Apr 22 14:03:25 CEST 2022



On 3/31/22 01:54, Sean Anderson wrote:
> Private data is initialized to all zeros by DM. Malloc does not do this.
> Initialize it. This fixes partition detection logic from trying to detect
> partitions in uninitialized memory.
> 
> Fixes: 0bf61aced2 ("sandbox: mmc: Support a backing file")
> Signed-off-by: Sean Anderson <seanga2 at gmail.com>

Reviewed-by: Jaehoon Chung <jh80.chung at samsung.com>


Best Regards,
Jaehoon Chung

> ---
> 
>  drivers/mmc/sandbox_mmc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/sandbox_mmc.c b/drivers/mmc/sandbox_mmc.c
> index 35159451e1..60a6be0add 100644
> --- a/drivers/mmc/sandbox_mmc.c
> +++ b/drivers/mmc/sandbox_mmc.c
> @@ -178,7 +178,7 @@ static int sandbox_mmc_probe(struct udevice *dev)
>  		priv->csize = 0;
>  		priv->size = (priv->csize + 1) * SIZE_MULTIPLE; /* 1 MiB */
>  
> -		priv->buf = malloc(priv->size);
> +		priv->buf = calloc(1, priv->size);
>  		if (!priv->buf) {
>  			log_err("%s: Not enough memory (%x bytes)\n",
>  				dev->name, priv->size);


More information about the U-Boot mailing list