From patchwork Thu Oct 29 00:25:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 319305 Delivered-To: patch@linaro.org Received: by 2002:a92:7b12:0:0:0:0:0 with SMTP id w18csp14906ilc; Wed, 28 Oct 2020 17:26:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYi1IxoF869eGqJkQUnhg9ValagQQo3i2egrIwsXYpTdI7Bh3XaQ0tbjQMRPnuJvgLueJ5 X-Received: by 2002:a05:6402:22e3:: with SMTP id dn3mr1434290edb.205.1603931172658; Wed, 28 Oct 2020 17:26:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603931172; cv=none; d=google.com; s=arc-20160816; b=l8Ranz4TPt/n0j2fzQt9cexYPOJ1OsIKg+Bb9IzQsBPUDt4iji1crg1Ln/M48YDsfx pp50y1xIfsT/vZemRLfwYg/MZRhLmJXeg+l1zrOo3jMqRkYIV8n+SG2Z3H82GEx2zOMw TvTWWNCD+1hADze4M7LJLzxNZSsAak1uGb+/toDWordXGppuvxT1y45mrcLvYoEbTmeF b4GHCBQXqmbFSvDZ32XhJ0s6JSzwu7LYTtEomv0dEsG+fs2MvcGkHJdVWfsdigW72cAl QA9panK5ZSkpNVUtYHnczwM6ektKOLs/zqCSmvhJPBQEkdCzpm0htHe52A4YbXfCmhRX gbeg== 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=gqY/srhD03OZnQsaQHroe9Z7PgmuG4jHelGJ5Q907Fk=; b=BcxAbXoambY8LWj6/CivqkPwUqUPfn+FRffnQIkokX9vrvupH8Hqog9XXkPyWTfeN+ dvBmkUl0uYTSAA8zqQMHyJlUR0hvYb5venwuJSefehJmdfBxF3fX2mAsU73ZqmAEr1El Xoogfy6BeMKnS1uv8F8Lb7O0MKiT2M9z0EV8gx6gnxIe2etzfVYoFOICgqwKTJcUzuD3 P25UaHe+i+jG38Xqw7O88GLXx1X6f++cvgDrKW7mjU5pUvVb5q6H6IS+wg2n1lwBBYyz swSKDKN7An8bnozS0d/8T26PKhN6inJw/MWPpr6vYGVsw8OAID9TjaAL22PLYSOrCGwu FOng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="XlZoGoO/"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id y16si883483edm.444.2020.10.28.17.26.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 17:26:12 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="XlZoGoO/"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 D15BA824C5; Thu, 29 Oct 2020 01:26:06 +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="XlZoGoO/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F3BE382434; Thu, 29 Oct 2020 01:26:02 +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 8A9AC82434 for ; Thu, 29 Oct 2020 01:25:59 +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 o129so880075pfb.1 for ; Wed, 28 Oct 2020 17:25:59 -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=gqY/srhD03OZnQsaQHroe9Z7PgmuG4jHelGJ5Q907Fk=; b=XlZoGoO/9+9TLJ+I5cBJ27w4nQDmn7640Fm2t8ixWfpjEpj+bwKm5k9OqxUNjoZ9F7 mMEzlnXHOZFuC2cIciVfg14O8rodwF6vSXfPvAcEyMku4cwOx7SYY18zE3jPb4RayCpr skj/rI4JS1Ll46XoU3XtZ5APB3xRadZ4OPqkoiQPTbm21Mo9n0WMpmXtKVSZt6P9Z7Qd aCA3hZfofoSPkfRFOSvZ8RXY7UVC8HzNq3dQWGV16FpoWXqdFqe4LiVG0roT3lNaYCnV aXKCVEkLbpJn1/br7iNp2Jpv6VVIbzbsGijgmY3IK+s+0AmzYkp5EynDVhcHru6vK8WA Byaw== 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=gqY/srhD03OZnQsaQHroe9Z7PgmuG4jHelGJ5Q907Fk=; b=qmt9LwX1v+wszWRHPInWDOhXDZDHSTyfY3KW+bmbLYE/fwp1XFI67UKwGKIq3LLF+n muhFQXWtj1SsCdDh+bhfoAliw4DvcGob7MB9ojNrlCZbjS71KdxIOAFGEiYUINQu2Irg iuMpBBles8WNPfHPyVFOF1J/KhlZ62WY6LeOor0p4M7aO8U1+NNvQ2MzDL540+5QQYDW ow1Fa9XIMbWt/GvTu1yzx9tMtw2NWVSnSkQD3tOQmzgrTNOrYlOPAEpVPo5AxtV49iob SnUpHQm2bUBJFpgtRsh29TWyP0JMUZK1oWYRYf54RSrPNF1mLX6fxPtbjzt6EpqlM/uD WJzA== X-Gm-Message-State: AOAM530bFsSzZawyATyn3xaKz7ER+tEqm8vFAUXBAIVhDC1XH5HsPS5X IbJyEHqppaYnayP3/5XUPGnS/Q== X-Received: by 2002:a65:50c5:: with SMTP id s5mr1646994pgp.399.1603931158153; Wed, 28 Oct 2020 17:25:58 -0700 (PDT) Received: from localhost.localdomain (p784a66b9.tkyea130.ap.so-net.ne.jp. [120.74.102.185]) by smtp.gmail.com with ESMTPSA id s22sm731502pfu.119.2020.10.28.17.25.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 17:25:57 -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: [RESEND PATCH v6 02/17] dfu: modify an argument type for an address Date: Thu, 29 Oct 2020 09:25:13 +0900 Message-Id: <20201029002528.34408-3-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201029002528.34408-1-takahiro.akashi@linaro.org> References: <20201029002528.34408-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 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 cecfbd76597b..2299a83a3d94 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_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) {