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 8B29EC47089 for ; Wed, 7 Dec 2022 08:55:55 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 76BEA8555D; Wed, 7 Dec 2022 09:54:23 +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="kofhu/04"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3DC05855A8; Wed, 7 Dec 2022 09:54:21 +0100 (CET) Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) (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 8CE468558D for ; Wed, 7 Dec 2022 09:54:17 +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-pf1-x429.google.com with SMTP id 124so17000116pfy.0 for ; Wed, 07 Dec 2022 00:54:17 -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=01dJjAHRNfOSrREIrWVmsW0pHjAGuwfR2ipI7kewnKE=; b=kofhu/043C65CoILIi6aQt7TOUU4etk1Hq9Cl3hCNpIBhWxyuAzE/LxMjl2FYO3GH0 jRDjbG5YeYjLmwEFqURGfvd6yMGvutfRA0qumdLgPzRB0pRTft6oXK+vJq00Q8v7tydj muhEEc+XF1eVQjqAOVJSN2s2vf/iiLgjqrhq8= 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=01dJjAHRNfOSrREIrWVmsW0pHjAGuwfR2ipI7kewnKE=; b=GAuEkkV51TVh1pxjqVH7+JXXuWlvjjKi5OR9eCmhRmZeHgfd2gi1xii+Nf8Zs3CuBZ AcSqSoOGa8gKBU7lE6vz9WRHneSLyEIpu6Dooxhx8spetv4sQ3MnRqJ2bkTPj3B9CmF+ WvyDXth+vS/+6hPUYpWd+niFdPyWZoi6cgipD9G4/hZWQHgIPvjl+bJI/8VgHHWVkZjv 8DrBRJIWu4ibzFYvq6NiJ8bE6uOkO6Wfj+DB+LVCDVkZ9Uxa1kbZ98lJ45mo8wogdeY8 QZrFtt/+Ad2YWiLFz0qzszIW2aOCpR5KHO481VKphlUFI+maY6QT+evBDOWm4HsRMRdH HikA== X-Gm-Message-State: ANoB5plHtqwpcVa6M3go9SwSfB3GHSjgbLvjDlY97tWlKYEGp1kF81iq GJzc9KtOWFb3dCdUVDS+DyTcnZdv4cUzI7q6 X-Google-Smtp-Source: AA0mqf7c1T2DhNeKhbqS4LxXWHlUfjd9Nm9dV+RVwuEfnW3FgbnyQxv0xJxjfIfSDL2Hwmk2Ot5lZg== X-Received: by 2002:a63:6446:0:b0:478:c3a2:bbcc with SMTP id y67-20020a636446000000b00478c3a2bbccmr10446948pgb.183.1670403256767; Wed, 07 Dec 2022 00:54:16 -0800 (PST) Received: from localhost.localdomain ([27.110.126.54]) by smtp.gmail.com with ESMTPSA id l16-20020a170903121000b0018157b415dbsm14145514plh.63.2022.12.07.00.54.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Dec 2022 00:54:16 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: U-Boot Custodians , Simon Glass , Jaehoon Chung , Peng Fan Subject: [PATCH 09/71] sandbox: mmc: Start off with a zeroed file Date: Wed, 7 Dec 2022 21:50:35 +1300 Message-Id: <20221207085137.445249-10-sjg@chromium.org> X-Mailer: git-send-email 2.39.0.rc0.267.gcb52ba06e7-goog In-Reply-To: <20221207085137.445249-1-sjg@chromium.org> References: <20221207085137.445249-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 --- 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.rc0.267.gcb52ba06e7-goog