From patchwork Mon Jul 13 12:40:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaistra X-Patchwork-Id: 1327930 X-Patchwork-Delegate: trini@ti.com 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=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=oQvBBapt; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=911q0/bt; 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 4B53C85Spjz9sRN for ; Mon, 13 Jul 2020 22:40:18 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3159380404; Mon, 13 Jul 2020 14:40:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linutronix.de 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; secure) header.d=linutronix.de header.i=@linutronix.de header.b="oQvBBapt"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="911q0/bt"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0014C80404; Mon, 13 Jul 2020 14:40:06 +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=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id F3E5780422 for ; Mon, 13 Jul 2020 14:40:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=martin.kaistra@linutronix.de From: Martin Kaistra DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1594644003; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=1vCsHkN6KpAaRknHrbbCw320lY72crf8EqEVJS8GcqA=; b=oQvBBaptpbUtD4bgLro/S+SwX+9Pc4neEz3F1VKfWRH5tMFSu9CXl/tBq0nXFygYrlj/iF 7xmBFvNhkCum17zK2JjTNyjSh2AYBpYr9c1PN0NhpCdQnrtywA5Uo5O6PKpapH6vjCABnA gH204axycxVBKKM/gh+WzvWkoML6KylQlgHjdQr3m4lUqtjLCFMTAvevjKvPLiJBXpc35r dAJg2ViYu4EjLgW452vWX1dFwuafGKbM0YrFacK0xY9vAz7SeBIk/kfW3khevryMTwAo/C v/I//Kb7whVN7MFzTZ1j0lxHUrkkG775+uTFBILblG68Yh9pmopI67Z+aXHgkw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1594644003; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=1vCsHkN6KpAaRknHrbbCw320lY72crf8EqEVJS8GcqA=; b=911q0/bt/XT70mShwaA3xMbLvCYrnwqPwW4cW703EPda8nlQi6AlsYqbjUFwvkfewPoSet moNYjsFAPwrL1oDA== To: u-boot@lists.denx.de Cc: miquel.raynal@bootlin.com, hs@denx.de, boris.brezillon@bootlin.com Subject: [PATCH] mtd: mtdpart: use uint64_t instead of int for cur_off Date: Mon, 13 Jul 2020 14:40:02 +0200 Message-Id: <20200713124002.20882-1-martin.kaistra@linutronix.de> 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 types of "offset" and "size" of "struct mtd_partition" are uint64_t, while mtd_parse_partitions() uses int to work with these values. When the offset reaches 2GB, it is interpreted as a negative value, which leads to error messages like mtd: partition "" is out of reach -- disabled eg. when using the "ubi part" command. Fix this by using uint64_t for cur_off and cur_sz. Signed-off-by: Martin Kaistra Reviewed-by: Kurt Kanzenbach Reviewed-by: Heiko Schocher --- drivers/mtd/mtdpart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index d1f6029b2bf..d064ac30480 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c @@ -207,7 +207,7 @@ int mtd_parse_partitions(struct mtd_info *parent, const char **_mtdparts, { struct mtd_partition partition = {}, *parts; const char *mtdparts = *_mtdparts; - int cur_off = 0, cur_sz = 0; + uint64_t cur_off = 0, cur_sz = 0; int nparts = 0; int ret, idx; u64 sz;