Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B9327C54EBC for ; Sun, 8 Jan 2023 02:54:26 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E144B856B8; Sun, 8 Jan 2023 03:52:11 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="enHaawaC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 088B8856AB; Sun, 8 Jan 2023 03:51:47 +0100 (CET) Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8A70585610 for ; Sun, 8 Jan 2023 03:51:06 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd30.google.com with SMTP id d123so2939560iof.6 for ; Sat, 07 Jan 2023 18:51:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mnNY9aNVKG1vzH2zH0ULXd/L8ktNzSEWbUkaFRKPVMQ=; b=enHaawaC2r1DLXpPb8CZxi7T1XUg8UJ0mmcp+/ICXD2N16qglRXSns/ErgHgNnkBwG O/KDSsnITp+Ep8XzSFpgFnXKx7nMnp172Bf2dhAKQOO1wBdig7w0dSiTWa49ppjwxqVB qpbQuB8UsPmsyTBPZcDe68/PrtR1jI8F0c/Uw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mnNY9aNVKG1vzH2zH0ULXd/L8ktNzSEWbUkaFRKPVMQ=; b=tjD4JNh5/UgER53fRM/Z/eCDWMRsKvFq8FlsfSyqeUM4SPoh8AdzOnWa1XZAxkM8YN 9soP5KxGcokmW9+7FwgExXRqAS68mS5XqWqe66e0Wwr859Wvwu3nM27JzKnezlhEx90l PQkjoQu2rtt0VhPl+6hoaxMa/c8rDVTm7OlDjNKl3ObjtX95exYqlsh0EwEO4sBRcd7K 4tgmgIIdjzPGIORdnJIwAcR8NDQjwNOM5P7VL2XsXJV67tsK9X5SSA4mP6+BWUDhZj4G NPLJpmigOpeB2vnlZZTFDaOU+RHMjUc6IpaYyLSePHQMxtH+uOL9pxICYyEdzpftWVuD GT7A== X-Gm-Message-State: AFqh2kpL6entrTBO+Hv7cRJhRY+9/HyQWCZE++lH/GOrjltn/168mGSO ssxtpePTAmyuWfjAwdYopVg+Dud5udeVQDDI X-Google-Smtp-Source: AMrXdXv79CMN0WxXSDLGoqu0TcIixILDK9X+t61Pq7Hn/Wn6nz4Tk3lc++LMK+4j8aon17WEkKZwbQ== X-Received: by 2002:a5d:83cf:0:b0:6e4:720a:2391 with SMTP id u15-20020a5d83cf000000b006e4720a2391mr38798356ior.2.1673146265012; Sat, 07 Jan 2023 18:51:05 -0800 (PST) Received: from sjg1.roam.corp.google.com (c-71-56-217-229.hsd1.co.comcast.net. [71.56.217.229]) by smtp.gmail.com with ESMTPSA id c17-20020a92bd11000000b00302a00aaefasm1622174ile.26.2023.01.07.18.51.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Jan 2023 18:51:04 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: U-Boot Custodians , Simon Glass , Jaehoon Chung , Peng Fan Subject: [PATCH v2 09/71] sandbox: mmc: Start off with a zeroed file Date: Sat, 7 Jan 2023 19:49:45 -0700 Message-Id: <20230108025047.522240-10-sjg@chromium.org> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog In-Reply-To: <20230108025047.522240-1-sjg@chromium.org> References: <20230108025047.522240-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean When running multiple tests the mmc emulator calls malloc() to obtain the memory for its disk image. Since the memory is not cleared, it is possible that it happens to contain a partition table. The dm_test_part() test (for one) relies on mmc0 being empty on startup. Zero the memory to ensure that it is. Signed-off-by: Simon Glass --- (no changes since v1) 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 ba79a5565c3..0ba7940a4db 100644 --- a/drivers/mmc/sandbox_mmc.c +++ b/drivers/mmc/sandbox_mmc.c @@ -183,7 +183,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.39.0.314.g84b9a713c41-goog