From patchwork Wed Sep 26 13:02:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 147583 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp694688lji; Wed, 26 Sep 2018 06:02:33 -0700 (PDT) X-Google-Smtp-Source: ACcGV62/NzPdmqjrdMNuraYXCBAuWcLc+Mdw9kLSTMF89wBQOVGGvCCxjs/Ja5x2yXN4SHJqiAfw X-Received: by 2002:adf:ac4a:: with SMTP id v68-v6mr4447801wrc.165.1537966953538; Wed, 26 Sep 2018 06:02:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537966953; cv=none; d=google.com; s=arc-20160816; b=pr6I0K3JHQP/p/jMJJMjKiQrt2pAUFBbfguZSahLQoGAKbEeNNxoLd1OelAuzUvb3k 5FF1WcxapzzqiL6DL3kVAiaIPjuNYgObGoqB8L5M97GMCQketZGTb4Peu9t8hnJcnokL X2LIe4yL6GS5hFLHp3h8yzKZGFVuBFZ3AUhXo7mzlnSXvJ5Akq/iklRFxjL2U7pYUyP4 Ny8ttNvL2/qF9NXMeBwlt1mTjY57pehPhFnUd3s9jjFvvcwseSx2eTP0GE1fyrts5wND dckvSnIlHd8w/fpwQ3/HjWj/E/OZNK3XVTaWGIAAt9T6SYOqomSZ4vwdfQXO+r0yQ8Mj 5SDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:message-id:date:to:from; bh=of0AN5neiR978yX13JhkUEwJjO/SGxxtGx7zYcuZPHw=; b=L6eLz/SHwK2QssgarGtBGgW1y7b4aeafAv0x+RM96wqi2laGDrr460M6YXaQ5gou2N knQ3xTLgNDRkMzsaUAyopKEyWafJbs7JTsDmLcHpOIgF4cah8HDsTauUYuQ2CWPN/hje nN8Cd0Ajp14VEKWwS++t9C3ctQYeu3L7/QH0JLKZERDpty8dQKDgh8cGCs/HJLj/RC4M dHfgCiHSm9BDMMj0plzRV/zQp15qPmo97pUkFFeGiTqz5A3MKufqpG2x4iBlcayqU8Hz iJKMcQMjyTSbAXwtSpGEmFFYZIv2ft9rHyZ64SsbfFpQcolbgq/ZwOYMiGisR9IJYezD 0XEQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id e16-v6si1616590eda.288.2018.09.26.06.02.33; Wed, 26 Sep 2018 06:02:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id C5BF1C21DB6; Wed, 26 Sep 2018 13:02:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 0E030C21DB6; Wed, 26 Sep 2018 13:02:24 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 0C6F8C21D83; Wed, 26 Sep 2018 13:02:22 +0000 (UTC) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 9385BC21C6A for ; Wed, 26 Sep 2018 13:02:21 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 0451CADF7; Wed, 26 Sep 2018 13:02:20 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Wed, 26 Sep 2018 15:02:19 +0200 Message-Id: <20180926130219.3551-1-agraf@suse.de> X-Mailer: git-send-email 2.12.3 Cc: trini@konsulko.com, Heinrich Schuchardt Subject: [U-Boot] [PATCH v2] sandbox: Fix set_working_fdt_addr users X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" When running sandbox with the new pointer sanitization we just recently introduced, we're running into a case with FIT images where we end up interpreting pointers as addresses. What happened is that most callers of set_working_fdt_addr() simply convert pointers into addresses without taking into account that they might be 2 separate address spaces. Fix the callers up to map their pointers into addresses. This makes sandbox tests pass for me again. Signed-off-by: Alexander Graf Reviewed-by: Simon Glass --- v1 -> v2: - convert callers instead of API, as the main user of set_working_fdt_addr() is address based --- common/bootm.c | 2 +- common/image-fdt.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/bootm.c b/common/bootm.c index e517d9f118..8bf84ebcb7 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -262,7 +262,7 @@ int bootm_find_images(int flag, int argc, char * const argv[]) puts("Could not find a valid device tree\n"); return 1; } - set_working_fdt_addr((ulong)images.ft_addr); + set_working_fdt_addr(map_to_sysmem(images.ft_addr)); #endif #if IMAGE_ENABLE_FIT diff --git a/common/image-fdt.c b/common/image-fdt.c index 9b41f16248..95748f0ae1 100644 --- a/common/image-fdt.c +++ b/common/image-fdt.c @@ -193,7 +193,7 @@ int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size) *of_flat_tree = of_start; *of_size = of_len; - set_working_fdt_addr((ulong)*of_flat_tree); + set_working_fdt_addr(map_to_sysmem(*of_flat_tree)); return 0; error: