[PATCH] mmc: fix improper use of memset

Peng Fan peng.fan at oss.nxp.com
Tue May 23 03:44:55 CEST 2023



On 5/19/2023 3:47 AM, Sam Edwards wrote:
> Caution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button
> 
> 
> Buffers created through DEFINE_(CACHE_)ALIGN_BUFFER are actually
> pointers to the real underlying buffer. Using sizeof(...) is
> not appropriate in this case.
> 
> Signed-off-by: Sam Edwards <CFSworks at gmail.com>
> ---
> 
>   drivers/mmc/mmc.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index 1af6af82e6..72c1076c56 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -2262,7 +2262,7 @@ static int mmc_startup_v4(struct mmc *mmc)
>                  return 0;
> 
>          if (!mmc->ext_csd)
> -               memset(ext_csd_bkup, 0, sizeof(ext_csd_bkup));
> +               memset(ext_csd_bkup, 0, MMC_MAX_BLOCK_LEN);

This looks correct to me. BTW: do you met any issues during test?

Reviewed-by: Peng Fan <peng.fan at nxp.com>


> 
>          err = mmc_send_ext_csd(mmc, ext_csd);
>          if (err)
> --
> 2.39.2
> 


More information about the U-Boot mailing list