From patchwork Fri Jun 19 01:51:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 1312521 X-Patchwork-Delegate: xypron.glpk@gmx.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=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=qUVBY6nz; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49p1zG6wp2z9sRR for ; Fri, 19 Jun 2020 11:52:58 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 439218213D; Fri, 19 Jun 2020 03:52:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="qUVBY6nz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 61A6782126; Fri, 19 Jun 2020 03:52:17 +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_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8850282124 for ; Fri, 19 Jun 2020 03:52:12 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=wdc.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=prvs=4322745af=atish.patra@wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1592531532; x=1624067532; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VclyrM/jpgRF2h/cBmvbprjxSK8mja3DhpfaRRLaq9Y=; b=qUVBY6nzxH/A2CrrQ++YKGrB7JtfpfEOOTB1bfUi7Eqh5B/FSxIigVOp VTpd6echIj24sE8vmRMk06FSILSmOE8mJK9L9usLbJZshUJk3yS0N1lKE 556FuaBztp/t+74i2Ork5hrEwaYkIDnBpYwX4TszXUK8Co+2KopKeFipx GMnA6gRuFxqvGIAhRslTbJVU2UuxQSsbajoeyQSW8LWeeeE8qThFtoOBH S7at/mIsFc56QXDXliYMu0FGmHFOBP2GAqgHaiVR0orz58qFdg5ImmNfM JFw6cHl81CLf3F5GZf8OJgyJuoMfjlDkRy1TF+oGgHO/IJF2VJytjQh7b Q==; IronPort-SDR: /me+qRLaZzvKZe7OTrsicETI7OJwMsr8cN5oAJ4b+JdfZMUnYJWC1i2yEHuWMEPhD0u5iAuJ3R mQHTOGu7A/6pce7fEw/otP9lfl9Vv5aichQG8v5TvU5tOyUAY5aMEF2JFgsatNBLKWgnKJMzAh AIyxxV52V1J81dAvVrvTKXOYlmaTyL1KqtvXktBv19DNJfMB6rBt39Zz65BvyNvniWYpMfjW5b FM0wDbLBIlxMPUgTtzc59wkc/Xdq2pVvoWqNffm1Uuz2l3GNYrLPrrt9CDB6AyHpyiqFn8Q5Mf cK0= X-IronPort-AV: E=Sophos;i="5.75,253,1589212800"; d="scan'208";a="249566750" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 19 Jun 2020 09:52:08 +0800 IronPort-SDR: RMGddmgoNsdADm0VebTPWYyp8xrZQXVoZpIelb49vt7wHWzRpEqn5AGKJ6MLF1Scm1nUgU+2fI ksEPj5AnE8bc88vteZVWvqLxmxjCVjmOc= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jun 2020 18:41:20 -0700 IronPort-SDR: JfNSGwkzXn6mvxNPFs1+SxE1xDaDPK+fBszUT35kZ5E++aNAPZK47x9dbGiHVHTjSbgHj4dB0G X4yFfTlRYvvg== WDCIronportException: Internal Received: from unknown (HELO jedi-01.hgst.com) ([10.86.58.110]) by uls-op-cesaip01.wdc.com with ESMTP; 18 Jun 2020 18:52:08 -0700 From: Atish Patra To: u-boot@lists.denx.de Cc: Atish Patra , Anup Patel , Bin Meng , Heinrich Schuchardt , Jagan Teki , Marek Vasut , Simon Goldschmidt , David Abdurachmanov , Tom Rini Subject: [PATCH 3/3] cmd: bootefi: Honor the address & size cells properties correctly Date: Thu, 18 Jun 2020 18:51:50 -0700 Message-Id: <20200619015150.27745-4-atish.patra@wdc.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200619015150.27745-1-atish.patra@wdc.com> References: <20200619015150.27745-1-atish.patra@wdc.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean fdtdec_get_addr_size reads the uses a fixed value for address & size cell properties which may not be correct always. Use the auto variant of the function which automatically reads #address-cells & #size-cells from parent and uses to read the "reg" property. Signed-off-by: Atish Patra --- cmd/bootefi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 0f6d0f77507c..5f3fcce597de 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -190,8 +190,9 @@ static void efi_carve_out_dt_rsv(void *fdt) subnode = fdt_first_subnode(fdt, nodeoffset); while (subnode >= 0) { /* check if this subnode has a reg property */ - addr = fdtdec_get_addr_size(fdt, subnode, "reg", - (fdt_size_t *)&size); + addr = fdtdec_get_addr_size_auto_parent(fdt, nodeoffset, + subnode, "reg", 0, + (fdt_size_t *)&size, false); /* * The /reserved-memory node may have children with * a size instead of a reg property.