From patchwork Mon Jun 9 09:02:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeroen Hofstee X-Patchwork-Id: 357357 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3D4A51400AA for ; Mon, 9 Jun 2014 19:02:24 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 94A28A73E3; Mon, 9 Jun 2014 11:02:23 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SnMXGHuwAk3m; Mon, 9 Jun 2014 11:02:23 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 250274A053; Mon, 9 Jun 2014 11:02:21 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 829834A053 for ; Mon, 9 Jun 2014 11:02:17 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jxopYjuc+c8V for ; Mon, 9 Jun 2014 11:02:14 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from orange.myspectrum.nl (orange.myspectrum.nl [149.210.134.247]) by theia.denx.de (Postfix) with ESMTP id 7BDE14A051 for ; Mon, 9 Jun 2014 11:02:10 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by orange.myspectrum.nl (Postfix) with ESMTP id 7AEDB8BE7B; Mon, 9 Jun 2014 11:02:10 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at myspectrum.nl Received: from orange.myspectrum.nl ([127.0.0.1]) by localhost (orange.myspectrum.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ThYo5YXxKL1s; Mon, 9 Jun 2014 11:02:10 +0200 (CEST) Received: from yellow (ip136-5-208-87.adsl2.static.versatel.nl [87.208.5.136]) (Authenticated sender: jeroen@myspectrum.nl) by orange.myspectrum.nl (Postfix) with ESMTPSA id 2D6768BE79; Mon, 9 Jun 2014 11:02:10 +0200 (CEST) Received: by yellow (Postfix, from userid 1000) id B09F8741F7A; Mon, 9 Jun 2014 11:02:09 +0200 (CEST) From: Jeroen Hofstee To: u-boot@lists.denx.de Date: Mon, 9 Jun 2014 11:02:02 +0200 Message-Id: <1402304522-31094-1-git-send-email-jeroen@myspectrum.nl> X-Mailer: git-send-email 1.8.3.2 Cc: Jeroen Hofstee Subject: [U-Boot] [PATCH] common: hash: zero end the string instead of the pointer X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de if algo->digest_size is zero nothing is set in the str_output buffer. An attempt is made to zero end the buffer, but the pointer to the buffer is set to zero instead. I am unaware if it causes any actual problems, but solves the following warning: common/hash.c:217:13: warning: expression which evaluates to zero treated as a null pointer constant of type 'char *' [-Wnon-literal-null-conversion] str_ptr = '\0'; ^~~~ cc: Simon Glass Signed-off-by: Jeroen Hofstee --- common/hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/hash.c b/common/hash.c index 7627b84..040eead 100644 --- a/common/hash.c +++ b/common/hash.c @@ -214,7 +214,7 @@ static void store_result(struct hash_algo *algo, const u8 *sum, sprintf(str_ptr, "%02x", sum[i]); str_ptr += 2; } - str_ptr = '\0'; + *str_ptr = '\0'; setenv(dest, str_output); } else { ulong addr;