public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Sean Anderson <seanga2@gmail.com>
To: u-boot@lists.denx.de
Cc: Peng Fan <peng.fan@nxp.com>, Simon Glass <sjg@chromium.org>,
	Jaehoon Chung <jh80.chung@samsung.com>,
	Sean Anderson <seanga2@gmail.com>
Subject: [PATCH 2/4] mmc: sandbox: Initialize backing buffer
Date: Wed, 30 Mar 2022 12:54:44 -0400	[thread overview]
Message-ID: <20220330165446.438925-3-seanga2@gmail.com> (raw)
In-Reply-To: <20220330165446.438925-1-seanga2@gmail.com>

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

 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);
-- 
2.35.1


  parent reply	other threads:[~2022-03-30 16:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-30 16:54 [PATCH 0/4] mmc: sandbox: Some small fixes Sean Anderson
2022-03-30 16:54 ` [PATCH 1/4] mmc: sandbox: Initialize the status register Sean Anderson
2022-04-22 12:03   ` Jaehoon Chung
2022-04-26  7:56     ` Jaehoon Chung
2022-08-13 15:26       ` Sean Anderson
2022-09-08 11:38         ` Jaehoon Chung
2022-03-30 16:54 ` Sean Anderson [this message]
2022-04-22 12:03   ` [PATCH 2/4] mmc: sandbox: Initialize backing buffer Jaehoon Chung
2022-03-30 16:54 ` [PATCH 3/4] mmc: Import some defines for R1 responses Sean Anderson
2022-04-22 12:03   ` Jaehoon Chung
2022-03-30 16:54 ` [PATCH 4/4] mmc: sandbox: Set the response Sean Anderson
2022-04-22 12:03   ` Jaehoon Chung

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220330165446.438925-3-seanga2@gmail.com \
    --to=seanga2@gmail.com \
    --cc=jh80.chung@samsung.com \
    --cc=peng.fan@nxp.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox