From patchwork Wed Sep 26 09:19:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 147554 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp472503lji; Wed, 26 Sep 2018 02:19:56 -0700 (PDT) X-Google-Smtp-Source: ACcGV63bmzLwWUUNsd5soUfVb3iPLHNvnlJghptzHJwHz7Kwsd4Hg/+8j6LjemgcNzJHqFHCAu7v X-Received: by 2002:a50:e885:: with SMTP id f5-v6mr8140504edn.117.1537953596724; Wed, 26 Sep 2018 02:19:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537953596; cv=none; d=google.com; s=arc-20160816; b=CjQS2pXCUBdIbud/7RjDI+TCqN5YgVm8eglqN/jYlDMmhEhqJVynH3oXr9dIHN1iPn 8Zp40+myl2xnUZeJUtSQ13exOviBj3RIqTI1B2jnZLpCdR2uww1/5LoucuG5mnWQW5Dq INJslLIjju53eYNdfmKx5eIu013Po3yfUuCP29GMolueWcxL3a30vnFOLCYLMlM7uFzp z5QExXRZXqik4p89P8ScBOR38saTKxiAvsEAnlSXPche+8J4QHxA+c4kVZ1JhRXZewxG O6pxXZAm80LApP5c/uXXE5xCmb3IQb1rTZEk7OEggN6cjzlXB9c8ULpw8EHTzMEAvqDV fEyg== 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=MZmo16pBUGjtrG1fWzDyyY6LtZQJYrkqVavjB4SWbR8=; b=S0UjrfCK7IdBeT2m4CwtxNL8U6y3kwi2RvSnXP8nVfDfoVNrTTcnFE+DMgOMTT/sM1 J1551PWtK+w6Zrc4mIIuYWcCuF6HOTsfmeTAyC/9WBzK9EloiBc/7WaTsb+YhbZxKoxl jJhvXz9/MHcVPjUPUA8PvXfn0N/WrVUHo+7Cl3HQPy8e3qDkiVX+P3OZclL3yQjHKAnm GQYL7dS7HHeUql1cm6VAFSm25DGLiMQayHEn16mD4fZcfevwQvIaOVYSRiGEIx35SAje zcRK8yYRQmWzB1p+cjhJCP1wYKTrg5L6kvAo+MNu3kFWql7euo4OdSuCGHnsx1enqTbZ sUTg== 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 u9-v6si803206edj.444.2018.09.26.02.19.56; Wed, 26 Sep 2018 02:19:56 -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 2745EC21DF3; Wed, 26 Sep 2018 09:19:55 +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 322E9C21C8B; Wed, 26 Sep 2018 09:19:53 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6E829C21C8B; Wed, 26 Sep 2018 09:19:51 +0000 (UTC) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 17093C21C6A for ; Wed, 26 Sep 2018 09:19:51 +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 BE268B043; Wed, 26 Sep 2018 09:19:50 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Wed, 26 Sep 2018 11:19:50 +0200 Message-Id: <20180926091950.51513-1-agraf@suse.de> X-Mailer: git-send-email 2.12.3 Cc: trini@konsulko.com, Heinrich Schuchardt Subject: [U-Boot] [PATCH] sandbox: Replace set_working_fdt_addr with pointer version 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. Since most callers of the set_working_fdt_addr() function are already at the pointer stage, let's just rename it to set_working_fdt() and pass in the pointer directly. This fixes sandbox fit tests for me. Signed-off-by: Alexander Graf --- cmd/fdt.c | 10 +++++----- common/bootm.c | 2 +- common/image-fdt.c | 2 +- include/fdt_support.h | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/fdt.c b/cmd/fdt.c index 28de467f96..1976e7e6b9 100644 --- a/cmd/fdt.c +++ b/cmd/fdt.c @@ -36,12 +36,12 @@ static int is_printable_string(const void *data, int len); */ struct fdt_header *working_fdt; -void set_working_fdt_addr(ulong addr) +void set_working_fdt(char *fdt) { - void *buf; + uintptr_t addr; - buf = map_sysmem(addr, 0); - working_fdt = buf; + addr = map_to_sysmem(fdt); + working_fdt = fdt; env_set_hex("fdtaddr", addr); } @@ -121,7 +121,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (control) gd->fdt_blob = blob; else - set_working_fdt_addr(addr); + set_working_fdt(map_sysmem(addr, 0)); if (argc >= 2) { int len; diff --git a/common/bootm.c b/common/bootm.c index e517d9f118..5d3a60927d 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(images.ft_addr); #endif #if IMAGE_ENABLE_FIT diff --git a/common/image-fdt.c b/common/image-fdt.c index 9b41f16248..f685d66fe9 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(*of_flat_tree); return 0; error: diff --git a/include/fdt_support.h b/include/fdt_support.h index 27fe564f0b..5658296498 100644 --- a/include/fdt_support.h +++ b/include/fdt_support.h @@ -191,7 +191,7 @@ void ft_pci_setup(void *blob, bd_t *bd); */ int ft_system_setup(void *blob, bd_t *bd); -void set_working_fdt_addr(ulong addr); +void set_working_fdt(char *fdt); /** * shrink down the given blob to minimum size + some extrasize if required