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: 247345 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp931242ilo; Sun, 2 Aug 2020 22:44:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxji61tPD17f/wnWiCfdstqO0+NfZfNzHYYfNPUewu2uCynqtApK1wN405+REFd+pL51KC3 X-Received: by 2002:a17:906:f8c3:: with SMTP id lh3mr15330733ejb.263.1596433483178; Sun, 02 Aug 2020 22:44:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596433483; cv=none; d=google.com; s=arc-20160816; b=zv7Npd+zoe8I3fNtvgyZJAL9acYFm2TRcjSvoowtOOCot+tmSrWVs10/tger0ELfft ndAglZmqryEroO6fQa7aW4Ofcc6/Xxs8v4VBOs/eidxQarMJ7qqJzLEcQIfp5ZghuH8w /+C9VI4WRDipFQIq4KpXmXJhNdg937PL8f1+1ypVNh+guY2lgWvvyRTFj+HMtoVmkcKn imobRg9h8SIX4LALz/W+JqfsJ3rM7On27c5gxTAeGK+uy84+VVrgo3x9tz0GrTwsR8iO 2XBJ5xtczsCx5G2jjwlts4oF42Zhdk5QkUbysRYj/jTfeZfD3+6cKfyCh/1J16J6Cne/ U1Kw== 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=pOO5cBhGB+tBkvcWqp3gECyQeGyYaN4YVZ4VxQoVeDw=; b=MKt8I8sKoPpHnvhOwHpHgBrxw5gJwWGr2ORZ7XlTjLOMsiWsGBpF+Aji+EiePt0Slo 7zQMoZeWpgeTdCm4grumauDPdWwRB26PRcFL7XD0Trp7KeQMPrixGwA6qKXJimboVrqw EYijuPaB8ayLSGLPd10eQSym9xZSacwzVMHwXV/yWG5j8KGgTM80lX7Ku2YemH2tuZIH 3pJdL2YDpZhZaer1o0JxjmQ5T82atuNDwW2w09CETWrep5upnGfM3PkJjqDZMd8dvQSF F62mAIrE++PvCsJKiiyrGlghBH1tpZbUmT8rf4x9TuVnlOyivTnNcPTO6rVMqhPSo62l VAkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RXWOl0oz; 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 gh13si9684852ejb.3.2020.08.02.22.44.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Aug 2020 22:44:43 -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=RXWOl0oz; 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 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-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(-) -- 2.27.0 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) {