From patchwork Mon Aug 3 05:43:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 1340092 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=RXWOl0oz; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BKn0803Tkz9sRN for ; Mon, 3 Aug 2020 15:44:55 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6B18A81EF5; Mon, 3 Aug 2020 07:44:34 +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="RXWOl0oz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E710A81D71; Mon, 3 Aug 2020 07:44:31 +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-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) (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 E8BB581D6D for ; Mon, 3 Aug 2020 07:44:28 +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-x1043.google.com with SMTP id ha11so10763203pjb.1 for ; Sun, 02 Aug 2020 22:44:28 -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=pOO5cBhGB+tBkvcWqp3gECyQeGyYaN4YVZ4VxQoVeDw=; b=RXWOl0ozPfYG8zjtnA3yB8G+7M+fw3iEojSNwY4e7DUAU13nileQv1v6k+Ux5+07+7 /WIiILwpSXIYHnKTgzjFEc9MiRRiob9/WybZupAtYUqoyHkpQt+xBXsBheZONUBHZenW x5LxBHKRTpTpHnCW3kHDzcsrjHhc6u1Z8lDi6NrupALYCCF907SyF2gHZeJnT8EKCH5e g9Nj3Iu2/vZ7KkSQER4LbaFG4AO1gEvYE5NFh8mrrQcwQLFN0t1mjOu8fXJe8YRXqii6 22PRDcGwmc81jez2bXIgKKycnJ9AFwwpISYvdlqlcz2MfbImP/tWasIzp3b43XlYrR7n XAHw== 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=pOO5cBhGB+tBkvcWqp3gECyQeGyYaN4YVZ4VxQoVeDw=; b=HNN+1WnTLJUfpC7Wry+jprmof5Yhit9RasI6kqq7WzuPEDrKilqAhS/VY+/XnUbrnR lUZn/RkRW7eyU28D8WEII/m7PO+bYo2DcXSBseL65SwIjKjxb1YDd3FgGsayASl9BtKb zUgUgDAqDlOvZQ+gklJAlAQJwY1sehSSGAfo9VUPOpRjCjtaEN32Kdmon3enLGff+1fp tkkMvaQLDqnPW6750fss8elj2KpiKingKf30KLH1m8pfVSO04FAAgaz8N/Rmmls7wVJX /rwqdZgEPYdoEwmGiUFFNVQaFLOZlEyEOGZHMC3xNQFltQz6rpbUo9AVmE60cAwKLdfe Nsrg== X-Gm-Message-State: AOAM533V/KjAAkzvN8KUH3mqE3MQHPaE6WaZar5qoYW6VrWfONhONnHG q8xzP1mlKHbv5EfainmKE7EHNA== X-Google-Smtp-Source: ABdhPJzYiFrHKJTUvw5n/i11DXC1vcs4Nu4aTSjmHd1OlMvWRMDhIagzv3JrNotD2PV2C5yh6Uc0UA== X-Received: by 2002:a17:90a:b386:: with SMTP id e6mr488368pjr.57.1596433467497; Sun, 02 Aug 2020 22:44:27 -0700 (PDT) Received: from localhost.localdomain (p784a66b9.tkyea130.ap.so-net.ne.jp. [120.74.102.185]) by smtp.gmail.com with ESMTPSA id r25sm16952633pgv.88.2020.08.02.22.44.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Aug 2020 22:44:26 -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 v5 02/17] dfu: modify an argument type for an address Date: Mon, 3 Aug 2020 14:43:40 +0900 Message-Id: <20200803054355.17356-3-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200803054355.17356-1-takahiro.akashi@linaro.org> References: <20200803054355.17356-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(-) diff --git a/common/update.c b/common/update.c index 7f73c6372da0..f82d77cc0be9 100644 --- a/common/update.c +++ b/common/update.c @@ -181,7 +181,8 @@ got_update_file: } 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 94b0a9e68317..327fffc0dba6 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) {