From patchwork Mon Sep 7 05:34:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 249190 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp3414394ilg; Sun, 6 Sep 2020 22:36:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQ72JK8+Xd2QhCTzqp2W9d9YYmCsyJ/p/7qrM065mmo3t5dDRzDt8vQ5cCRjoaauLcSEfK X-Received: by 2002:a50:ce09:: with SMTP id y9mr19583777edi.91.1599456993327; Sun, 06 Sep 2020 22:36:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599456993; cv=none; d=google.com; s=arc-20160816; b=trPHfBFN7rsHMvg7b0KdtaV/JuA/hKUgYN2tjiqPQwuTob1We/n52OodHU9UMJr7ok Zn8ooa9Idm6ohrrNDmS90kn8NwTHGexRPLdoy6v2dDZYABtk2W25teTg1qrPD+HxBQra WHcL0KfFV87q263QXspk43yb+vOfgvG600rWDvZ6YWL9/9o1PzSAd+vGSqfGBL4OaRzT DL+wSyYC7ej0slNEL2mK+VN0oPy50yv801XGVvQfvg3obtHVNwL/5mUx/Cl/O0aBIUMl hjUt4AlblNCxOOeKiJAe5vGLVl0CWggJkokCJ6wL6nY0orq80M1vkasIWhuYTfbxqhvD wp/g== 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=wSiOFuGygQyuHPzpsGSq2hY753soWWssgrUw/DmrBBF82+RZaoeaDoEOzytn1R+FZr sGhhkahkX66vBKrrlFyr5wzL4EHEAw5lCyacaPmtdEYN3vIYwBAmiiCSDV7CTSTv/rS0 vO3sqawIR4Qjl3N4RPgk4JAG0zPD1cRDoTcyL5A7wcGBbbMuvs9nwoz5o9AKyhbCzXJN FH2tdRCBfyQ/0DR4cFY+ijwxFDT/jYa1Dh/S6ogGHFoetXNg8SoK4E27I4jQdraC/80X 7Ui3aJhrnRUrjP4zZD6VywStAx9W/d2lmz5zuXi24PV8A0xkTcM37KdCz6cI2yWLDpcZ dDMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FOYOR5Me; 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 u17si3367948ejj.110.2020.09.06.22.36.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Sep 2020 22:36:33 -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=FOYOR5Me; 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 4713A824CE; Mon, 7 Sep 2020 07:36:04 +0200 (CEST) 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="FOYOR5Me"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0CC4E824BE; Mon, 7 Sep 2020 07:35:55 +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_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) (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 5F39F824A9 for ; Mon, 7 Sep 2020 07:35:45 +0200 (CEST) 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-pj1-x1041.google.com with SMTP id gf14so5914364pjb.5 for ; Sun, 06 Sep 2020 22:35:45 -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=FOYOR5Merpq9h8upFyhoEHzuuwgLNkyaUHnS4jCd//u5Pj4BTU52AUGLW/lN9EnYU9 POLmOMbIFF1Fbqc4OR2Kujs0f75RDrCaOY0/bKpsP2TBS/b7vLa0anZW3XMHHT2QVhoY N+owubPgjSiJwhsb+uGfYcGJ9IQgqf35cO+KCCpm8/x9FKUNwzaZCjnjlbMqBp7FiWXC pC857G+MTY+A5ueFccIDISlPRyCM9Ge4LkE32D0NL5jHdzxPZ1h5NxKqhdYy6CvOBzKJ 8a0eCTqqMuqUrO3+flbXg+plrWy+2efMY22lboRbCDQJYgM8KbklZkCIHJZZNRkXYC2E IdLw== 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=VNevUfMkoM1T56W5EnwlJ9X2b0i3gqEUePq4nMAzJ64kE3Ri5rJytqmvts7oaOT6y9 mmVM4tYmwpqNxI09P6uys9oceexOyhK/Yam7kwaAZoaRsIDCrZMYubsPgWx/B0lIbJTX VVr8LKLSgLJ2M3QLPoFH/+/aKG8+rRINoE9QqoPJB8wEzq1eyg2AzdgHcYJo0KjaooHF +RXvrO6vFBkCmpIKqIZ9svbNxWQNl/6A2cb5s8g1JUSSK+Oij8eo9K+Iv4Q3qyOfX/vC DoVc2TqdsmBvG4L0jmcKcHb8OihziJwNA1JZn+BVWN+u4VpFIK/97f/Nur5XbqaT9Taw m0RA== X-Gm-Message-State: AOAM533PWO9nuqXnmitPvpG+yKg8elehehCGNDZgp2Z4r+kWnyc9Hy0t eVbtOcQFv5pDlmdxTPO/IdfHOA== X-Received: by 2002:a17:90a:ad48:: with SMTP id w8mr18996586pjv.179.1599456944300; Sun, 06 Sep 2020 22:35:44 -0700 (PDT) Received: from localhost.localdomain (p784a66b9.tkyea130.ap.so-net.ne.jp. [120.74.102.185]) by smtp.gmail.com with ESMTPSA id w6sm10783939pgr.82.2020.09.06.22.35.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Sep 2020 22:35:43 -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 v6 02/17] dfu: modify an argument type for an address Date: Mon, 7 Sep 2020 14:34:11 +0900 Message-Id: <20200907053426.1675646-3-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200907053426.1675646-1-takahiro.akashi@linaro.org> References: <20200907053426.1675646-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) {