public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] mmc: fix improper use of memset
@ 2023-05-18 19:47 Sam Edwards
  2023-05-23  1:44 ` Peng Fan
  2023-06-01 15:25 ` Tom Rini
  0 siblings, 2 replies; 4+ messages in thread
From: Sam Edwards @ 2023-05-18 19:47 UTC (permalink / raw)
  To: u-boot; +Cc: Sam Edwards, Jaehoon Chung, Peng Fan

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@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);
 
 	err = mmc_send_ext_csd(mmc, ext_csd);
 	if (err)
-- 
2.39.2


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

* Re: [PATCH] mmc: fix improper use of memset
  2023-05-18 19:47 [PATCH] mmc: fix improper use of memset Sam Edwards
@ 2023-05-23  1:44 ` Peng Fan
  2023-05-23  2:20   ` Sam Edwards
  2023-06-01 15:25 ` Tom Rini
  1 sibling, 1 reply; 4+ messages in thread
From: Peng Fan @ 2023-05-23  1:44 UTC (permalink / raw)
  To: Sam Edwards, u-boot; +Cc: Jaehoon Chung, Peng Fan



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@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@nxp.com>


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

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

* Re: [PATCH] mmc: fix improper use of memset
  2023-05-23  1:44 ` Peng Fan
@ 2023-05-23  2:20   ` Sam Edwards
  0 siblings, 0 replies; 4+ messages in thread
From: Sam Edwards @ 2023-05-23  2:20 UTC (permalink / raw)
  To: Peng Fan, u-boot; +Cc: Jaehoon Chung, Peng Fan

Hi, Peng Fan! Thank you for your review. :)

On 5/22/23 19:44, Peng Fan wrote:
> This looks correct to me. BTW: do you met any issues during test?

I do not think I understand the question.

Are you asking, "Did you send this patch because the current MMC driver 
was having problems on a real device?" If so, the answer is no. I only 
sent this to resolve a compiler warning.

Or are you asking, "Did you have any problems while testing after making 
this change?" If so, the answer is still no. But I also do not know 
whether or not my use of this driver was hitting this specific memset() 
at all.

Kind regards,
Sam

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

* Re: [PATCH] mmc: fix improper use of memset
  2023-05-18 19:47 [PATCH] mmc: fix improper use of memset Sam Edwards
  2023-05-23  1:44 ` Peng Fan
@ 2023-06-01 15:25 ` Tom Rini
  1 sibling, 0 replies; 4+ messages in thread
From: Tom Rini @ 2023-06-01 15:25 UTC (permalink / raw)
  To: Sam Edwards; +Cc: u-boot, Jaehoon Chung, Peng Fan

[-- Attachment #1: Type: text/plain, Size: 375 bytes --]

On Thu, May 18, 2023 at 01:47:07PM -0600, Sam Edwards wrote:

> 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@gmail.com>
> Reviewed-by: Peng Fan <peng.fan@nxp.com>

Applied to u-boot/next, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

end of thread, other threads:[~2023-06-01 15:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-18 19:47 [PATCH] mmc: fix improper use of memset Sam Edwards
2023-05-23  1:44 ` Peng Fan
2023-05-23  2:20   ` Sam Edwards
2023-06-01 15:25 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox