From patchwork Thu Aug 27 08:51:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gary Bisson X-Patchwork-Id: 1352381 X-Patchwork-Delegate: lukma@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=boundarydevices.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=boundarydevices-com.20150623.gappssmtp.com header.i=@boundarydevices-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=AUBxoGqS; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Bcc0S2qbMz9sSJ for ; Thu, 27 Aug 2020 18:51:34 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 64F098006D; Thu, 27 Aug 2020 10:51:23 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=boundarydevices.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=boundarydevices-com.20150623.gappssmtp.com header.i=@boundarydevices-com.20150623.gappssmtp.com header.b="AUBxoGqS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id ED71080422; Thu, 27 Aug 2020 10:51:21 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) (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 C77C98004A for ; Thu, 27 Aug 2020 10:51:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=boundarydevices.com Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=gary.bisson@boundarydevices.com Received: by mail-wr1-x441.google.com with SMTP id c18so18965wrm.9 for ; Thu, 27 Aug 2020 01:51:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=boundarydevices-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=wsm3wd3e7D2NufxNnRjVDUfXiZNwGXn0KIIZrZNAyc0=; b=AUBxoGqSlDGXeLBlLhzYiJynJvs/8iKT0x9UwJ8QEukpVmhL/aQWoYG5cAUs3P7+/G Y6LWnvBHTFVUhWlVrkmAt8VDDHDsoLIke/LaP/E5rJj4TG6L7kA/NulLR490dtlYdqZH GNHA93aoYaXtsIgyYXypR0b4vpv+PdHDBFTaJHu7aMU+VDu6wP7iFRQhIGjP/++zJPix LLktMhEosLe9dZx7bLOJZIIvUitdGe5N71s1OI2by8snMLj7zk2bjP/VMCJiKHMQkALF tOM9NE7scGL3sAsa8w+MSxD/QS6B/ZHFhxhvzUAUvaG0XTWb6Ia7LLrPQmxUZFacrVa7 R9iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=wsm3wd3e7D2NufxNnRjVDUfXiZNwGXn0KIIZrZNAyc0=; b=A7oNJ0rWouHVhy7t/ExO65OkwXP3v8hAcUeN13MkarlJTkJt4j5tkwtUEVpKv+PfZ4 if8TDmp91glxsDh3EwimNipn+SiFaTDL21mGbcAopBhGxM1xYIS2wmAdmNRcVlN1gqF2 8aJprURLWKoV9DMMFFtqnJXlEK2KcqvxEtQQvlSSQXNu6PV91YHN+oCVcQu0Rw+fRtW1 Wy0FjRjTd5PLU/OcdnuvqOlHmOAWv7SaJATaimh8Ksgqb2WvE0RupbfrvsSk0U+bPtKU 5yY7YgSvBJFRzqnvQiXcwsspyB3dpk26kq79adHdVdk2rH/yU1J3L86qqRXmxvEU42Hn k88A== X-Gm-Message-State: AOAM530tLZphnoK3bizbUAa6/D0I12D7SvWIWfYI6lnoKawQT/M5M5BL Ku5en7WqcWpEffzJCexoF7JkG7X4tMvmKw== X-Google-Smtp-Source: ABdhPJx7W5jHYBssLNIU0aLKmWVmXlBU/mfJ6fnu6oiYGToNuBkJjIv14xj6D8BDyLMobIHG/IwpLg== X-Received: by 2002:a5d:4f12:: with SMTP id c18mr1969555wru.33.1598518277994; Thu, 27 Aug 2020 01:51:17 -0700 (PDT) Received: from p1g2.home (2a01cb000f8e2700bc3737b82bb8b0cf.ipv6.abo.wanadoo.fr. [2a01:cb00:f8e:2700:bc37:37b8:2bb8:b0cf]) by smtp.gmail.com with ESMTPSA id j24sm4935730wrb.49.2020.08.27.01.51.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Aug 2020 01:51:17 -0700 (PDT) From: Gary Bisson To: u-boot@lists.denx.de Cc: lukma@denx.de, sjg@chromium.org, Gary Bisson Subject: [PATCH v2] fastboot: getvar: fix partition-size return value Date: Thu, 27 Aug 2020 10:51:14 +0200 Message-Id: <20200827085114.21970-1-gary.bisson@boundarydevices.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean The size returned by 'getvar partition-size' should be in bytes, not in blocks as fastboot uses that value to generate empty partition when running format [1]. Note that the function was already returning the proper size in bytes for NAND devices (see struct part_info details). [1] https://android.googlesource.com/platform/system/core/+/refs/heads/android10-release/fastboot/fastboot.cpp#1500 Signed-off-by: Gary Bisson Reviewed-by: Sam Protsenko --- Changelog v1->v2: - removed change for FASTBOOT_FLASH_NAND as not necessary (and therefore not building) --- drivers/fastboot/fb_getvar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/fastboot/fb_getvar.c b/drivers/fastboot/fb_getvar.c index 52da34b1e37..d43f2cfee66 100644 --- a/drivers/fastboot/fb_getvar.c +++ b/drivers/fastboot/fb_getvar.c @@ -95,7 +95,7 @@ static const struct { * * @param[in] part_name Info for which partition name to look for * @param[in,out] response Pointer to fastboot response buffer - * @param[out] size If not NULL, will contain partition size (in blocks) + * @param[out] size If not NULL, will contain partition size * @return Partition number or negative value on error */ static int getvar_get_part_info(const char *part_name, char *response, @@ -109,7 +109,7 @@ static int getvar_get_part_info(const char *part_name, char *response, r = fastboot_mmc_get_part_info(part_name, &dev_desc, &part_info, response); if (r >= 0 && size) - *size = part_info.size; + *size = part_info.size * part_info.blksz; # elif CONFIG_IS_ENABLED(FASTBOOT_FLASH_NAND) struct part_info *part_info;