From patchwork Thu Oct 29 04:47:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 319341 Delivered-To: patch@linaro.org Received: by 2002:a92:7b12:0:0:0:0:0 with SMTP id w18csp141598ilc; Wed, 28 Oct 2020 21:49:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfzT+elZrSToWna5DdGtmqRFWiFxdnyzxMQjdPfPBF1OqYVwZVp4IEbwSH7+elEs5rQNPs X-Received: by 2002:aa7:c704:: with SMTP id i4mr2191149edq.51.1603946991826; Wed, 28 Oct 2020 21:49:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603946991; cv=none; d=google.com; s=arc-20160816; b=dmod2jEZlHcDbntYywbDwEgvR385VdYg1YBadNStSQ57JsQvVN5rDSBQVGYn7hJsyx t93PJKJe4qk3OGqaIPILltZWtqbf0/pYNLGFfHLYiHGlNtJ4QGbESSMnu7mTpUKsRqMU t+AQhEPwYFtq2WVIjxJKCvHhuOpa6SboX3EQQv7qA4eOcxF+lrjFi+VTzqXRlf1DBlmU qna70CzHYIzS3Kk4aw62Z3K0l9jJiJ3kJ8ds4F8vSCFKt7KQr0O/3dKRMoUh1HnyTiB/ rSFgFJZ/cBqtnM6506Dv1AMo7vcXTgt7GTn9uuwZI71HN1Xx5Ph8z8FJBWWVkaCATb10 g6MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=n8Pj9XZPABDumjpzo1x+qe+FsXyFIB9vF6EC2r6C1+I=; b=fzz2H38MH3sh+a6ZM4taBjt6Fbj162pqr2dUE3VSwR5mkmJeG1RYscXDuZy2/FQZkj wOemDcszZXiOnJ7M0/u1qQ0Rz05sg+eIK6fC5g2ZZd2KPfWZAwUPjqPTb85f6cGsrSjn TnaC4ZylFJyO9ExTbZFlEzy2zE02+Lx3B8iMaRehbESERUKql+K1p5ioVX+3NYET0p+B gZib+1DSzOQAl5mN1C3NPAFrI1l0ToB9HPJ+pEsqP5Xb+XPi3LXh17sepaBa4sI0Z3xj ctjaZYidhaxqTG/AWreMUXiXqfApScs+wq04ISA3oTkn7+1UitFEw4sUHlUmwvI0upSP 2y5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=m6IWrU9r; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id v5si1744020edi.14.2020.10.28.21.49.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 21:49:51 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=m6IWrU9r; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2C711824D3; Thu, 29 Oct 2020 05:49:48 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="m6IWrU9r"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 20E7B82369; Thu, 29 Oct 2020 05:49:45 +0100 (CET) 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 mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0: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 4F71182369 for ; Thu, 29 Oct 2020 05:49:42 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pf1-x441.google.com with SMTP id y14so1309248pfp.13 for ; Wed, 28 Oct 2020 21:49:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=n8Pj9XZPABDumjpzo1x+qe+FsXyFIB9vF6EC2r6C1+I=; b=m6IWrU9rwnglue+sTiWb2hChDqbLKjDVs0EOpQzmqV7+4NApUexN8Lro6qEYHppRR/ ukhxK4VvvVvllRzZMJyzhJvWSPmvgwozN2qopAX6yGzrKTgk0w/n2NWKA3XJvwRZZfAp I1D4utdpqxe276exYegKJ7CNKdoV3yi11ABZ67m/7BVhd/wQMwYCKQHbT9DwjL8ViJYg g+4BpdBCp8d674y8gB3BMyyzNzdkjLL9dTy25kkSYNXmMIq1KnceLI6gmUAhMdDhXPlk Fq9stoAg9JmbYtQvJDMsxxd9EtGslAQlCuFXw3y4yhLT1jufORv0T7cHB2/5QR+vdZov 6uUA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=n8Pj9XZPABDumjpzo1x+qe+FsXyFIB9vF6EC2r6C1+I=; b=LDk3bJre4AOgVFh9tg3YCxTWSHJJfv5efh2WWyhSo0exPz2gnes4+I5y7FLa3Np4m0 LGj09p4JM6xWDL5fZVfEPiaXhggiv2yeROis272zJ/WYZQws5FfrOVrpI/cHAZglmyVN X141ElEYHFFk8wcKDrc01wfaZ9VVKolVTiEjealeIH4qPr1TIehlIHgrU25aEv/Tz4h6 KTuCH5WNRTBxVYlw2W8hO9XSV0cJV08gD9K7Ujxcemuzs8m6ReYFAJoCPDNpae62bt1k wAOy6VJxXq+l/BLBUFCWrlKTj/0OSEJDrnv77ORKvdd/1iXGEPLie85fK9qQYCi50iax bASQ== X-Gm-Message-State: AOAM532XpTQoh/xh4oYrrRpVaH0QhRKq6lUL3hCaHmyZr+pfgKQmvV3E u2sXTjtBUdyE2nbYaAdr6Q39MpTY0mf+6A== X-Received: by 2002:a17:90a:4549:: with SMTP id r9mr2484356pjm.146.1603946980928; Wed, 28 Oct 2020 21:49:40 -0700 (PDT) Received: from localhost.localdomain (p784a66b9.tkyea130.ap.so-net.ne.jp. [120.74.102.185]) by smtp.gmail.com with ESMTPSA id t14sm830689pjy.46.2020.10.28.21.49.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 21:49:40 -0700 (PDT) From: AKASHI Takahiro To: lukma@denx.de, trini@konsulko.com, xypron.glpk@gmx.de, agraf@csgraf.de Cc: sughosh.ganu@linaro.org, u-boot@lists.denx.de, AKASHI Takahiro Subject: [PATCH v7 02/17] dfu: modify an argument type for an address Date: Thu, 29 Oct 2020 13:47:42 +0900 Message-Id: <20201029044757.183262-3-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201029044757.183262-1-takahiro.akashi@linaro.org> References: <20201029044757.183262-1-takahiro.akashi@linaro.org> 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 range of an addressable pointer can go beyond 'integer'. So change the argument type to a void pointer. Signed-off-by: AKASHI Takahiro Reviewed-by: Heinrich Schuchardt --- common/update.c | 3 ++- drivers/dfu/dfu_alt.c | 6 +++--- include/dfu.h | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) -- 2.28.0 Reviewed-by: Tom Rini diff --git a/common/update.c b/common/update.c index 39946776d74f..8dd6ee8b7ddb 100644 --- a/common/update.c +++ b/common/update.c @@ -324,7 +324,8 @@ got_update_file: } } else if (fit_image_check_type(fit, noffset, IH_TYPE_FIRMWARE)) { - ret = dfu_write_by_name(fit_image_name, update_addr, + ret = dfu_write_by_name(fit_image_name, + (void *)update_addr, update_size, interface, devstring); if (ret) diff --git a/drivers/dfu/dfu_alt.c b/drivers/dfu/dfu_alt.c index 5b1b13d7170d..7528806cd163 100644 --- a/drivers/dfu/dfu_alt.c +++ b/drivers/dfu/dfu_alt.c @@ -23,14 +23,14 @@ * * Return: 0 - on success, error code - otherwise */ -int dfu_write_by_name(char *dfu_entity_name, unsigned int addr, +int dfu_write_by_name(char *dfu_entity_name, void *addr, unsigned int len, char *interface, char *devstring) { char *s, *sb; int alt_setting_num, ret; struct dfu_entity *dfu; - debug("%s: name: %s addr: 0x%x len: %d device: %s:%s\n", __func__, + debug("%s: name: %s addr: 0x%p len: %d device: %s:%s\n", __func__, dfu_entity_name, addr, len, interface, devstring); ret = dfu_init_env_entities(interface, devstring); @@ -69,7 +69,7 @@ int dfu_write_by_name(char *dfu_entity_name, unsigned int addr, goto done; } - ret = dfu_write_from_mem_addr(dfu, (void *)(uintptr_t)addr, len); + ret = dfu_write_from_mem_addr(dfu, (void *)addr, len); done: dfu_free_entities(); diff --git a/include/dfu.h b/include/dfu.h index a4cd86c0a6c4..d3d7e07b60d8 100644 --- a/include/dfu.h +++ b/include/dfu.h @@ -507,10 +507,10 @@ static inline int dfu_fill_entity_virt(struct dfu_entity *dfu, char *devstr, * Return: 0 - on success, error code - otherwise */ #if CONFIG_IS_ENABLED(DFU_WRITE_ALT) -int dfu_write_by_name(char *dfu_entity_name, unsigned int addr, +int dfu_write_by_name(char *dfu_entity_name, void *addr, unsigned int len, char *interface, char *devstring); #else -static inline int dfu_write_by_name(char *dfu_entity_name, unsigned int addr, +static inline int dfu_write_by_name(char *dfu_entity_name, void *addr, unsigned int len, char *interface, char *devstring) {