From patchwork Mon Jul 17 16:00:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 789586 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xB7LL410qz9s06 for ; Tue, 18 Jul 2017 02:00:42 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="KH8lF8tW"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=PSmbK+dsVuZlQz0ogyTkzaSxzalOz2b+X5QyknD8jJ0=; b=KH8lF8tWpSbFCk zjoEZMPxZgBNdUf7BzavOEWwnKe/hXDE+kBPuVoJiWPXIouRWqdTiODrzZFk8gTyG3so7Q6jxJPs6 j9bzE3wxfDrP9qzd5fGROD5GKKhtAWVSVgEby39IPdY5YS69llAc33RKwcxEtTHyet7k+nPEsYzTo s+IUoeUUQxcKOtzG02K8vOG7Olf5iybumT62m5gMgaWTm2STj1j1220ybt+rtVxixfKv68ZY+rOIW hurghBUyLTERfiGmGEjmaQc6TXfrTGS8fTscJYymr7L6utEIFDJJFMFRxCD20ATzP1KDYWFV+HV35 vknHsz272E1HXtYD5Whg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dX8Rk-000406-Rj; Mon, 17 Jul 2017 16:00:32 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dX8Rf-0002oy-Hk for linux-mtd@lists.infradead.org; Mon, 17 Jul 2017 16:00:29 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1dX8RF-00069y-Op; Mon, 17 Jul 2017 16:00:01 +0000 From: Colin King To: Richard Weinberger , Artem Bityutskiy , Adrian Hunter , linux-mtd@lists.infradead.org Subject: [PATCH][next] ubifs: fix uninitialized error variable err Date: Mon, 17 Jul 2017 17:00:01 +0100 Message-Id: <20170717160001.20285-1-colin.king@canonical.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170717_090027_736239_FCFF6596 X-CRM114-Status: UNSURE ( 9.41 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [91.189.89.112 listed in list.dnswl.org] -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Colin Ian King Variable err is not initialized and so the check to see if it is non-zero is basically checking a random garbage value. Fix this by initializing err to zero. Detected by CoverityScan, CID#1451370 ("Uninitialized variable") Fixes: 781f675e2d7e ("ubifs: Fix unlink code wrt. double hash lookups") Signed-off-by: Colin Ian King --- fs/ubifs/tnc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c index 0a213dcba2a1..ec18304fe0e1 100644 --- a/fs/ubifs/tnc.c +++ b/fs/ubifs/tnc.c @@ -1884,7 +1884,7 @@ static int search_dh_cookie(struct ubifs_info *c, const union ubifs_key *key, struct ubifs_dent_node *dent, uint32_t cookie, struct ubifs_znode **zn, int *n) { - int err; + int err = 0; struct ubifs_znode *znode = *zn; struct ubifs_zbranch *zbr; union ubifs_key *dkey;