Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2762373imj; Mon, 11 Feb 2019 08:06:31 -0800 (PST) X-Google-Smtp-Source: AHgI3IbLvbICaJSQnf6TjXBjdnYK4NNxySN0CObgBI0bQfvlwfaAsrdPjH4uFCVD0PQ3MfEDDjNq X-Received: by 2002:a63:4d:: with SMTP id 74mr34598370pga.248.1549901190947; Mon, 11 Feb 2019 08:06:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549901190; cv=none; d=google.com; s=arc-20160816; b=DV2QvpuHTlPhv4viUbH+LWEOiy+HFH82zTlmBPk5dOa3kepCZTfyHPMhJIQBIdDOpm uQaqb7AqWIJ4+eLzFC6mG3ba2N3VLLhET3odW1PD2+AzPSqKm3oZdjTgUfoddrUi/sb8 +neMti1psd7HQLky2vWLvyy8bY6AphCc6mN0tR2V1cid3UECthIgEBWQ3q4+VWMIYs9t Lw+0Dj0GIKLFSH32YvpF+ywbn87J93fDWc2ZOfJhxExfvnNlPOyiG5XCUmlnIg4aY9li UAcREbcjfpVL3koqlpcge7nTDcBqdY1df23m1LpNF596trmwc9ACl9lFMyjdHjmhc4hc RScg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9VDztmvLDW0Jr5R4UYbzqPlt/mNP78PAQsBjdK7ha6w=; b=f0vCHLh0iZKhox+TC4/pBdS3FXFrZbL7bYezRqjUyGpj+2zKJkyWsbQ6WApVx2tCc3 D8JdROFDcDcuBu9LPsmLJtJIXMMd9SaFmKqTZWJIGBAUmL0VlaM7fNxXgkBgr7nfjDZ3 b9lPz+0+SZdbdTG2VQs3Yp1mUSY5UtyFiV0IJ9Sd2BHR/CjN79sa8ybMXMBOkaEaVgMw fhJmeBlw5uFjlQe5EEpWtbPwg+9BPoi7LIbErgWi+p6ifQAejfT+fLA9i2DOUPcMpTSF bY8fMiLlrknwqUE+OnIUSTEq9AX+jDNnFjoaP79aQjlvbncBVxyvh/zcgKs4cx7B4VzI 1+PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fx8Gnx3I; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f186si10381377pfb.67.2019.02.11.08.05.57; Mon, 11 Feb 2019 08:06:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fx8Gnx3I; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728460AbfBKO2N (ORCPT + 99 others); Mon, 11 Feb 2019 09:28:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:34026 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727959AbfBKO2J (ORCPT ); Mon, 11 Feb 2019 09:28:09 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C4E9620838; Mon, 11 Feb 2019 14:28:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895288; bh=quk47f2brUt6xwGxlZ0z5GgqdUyoaBNQAFQ9yMo+4es=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fx8Gnx3IqgZvoOyoKk3vA7Y9vNQR1VMn9sfotF4kR/DwovN9P2trWa6rBlh0wXKNg Aw5tQtb4Cz+hm62RQYEq5jhea0OAcegW83wdg5tfqFptBWgJE7wbzn9YIeKH+iSjF+ ibgoy4HPawizk02RaQJGbUDiZagl/C+V445OAdCg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , =?UTF-8?q?Matias=20Bj=C3=B8rling?= , Jens Axboe , Sasha Levin Subject: [PATCH 4.20 156/352] lightnvm: Fix uninitialized return value in nvm_get_chunk_meta() Date: Mon, 11 Feb 2019 15:16:23 +0100 Message-Id: <20190211141856.685540887@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 55e58c5e78aad9d3246f57e7718cf5ee7adde9e3 ] With gcc 4.1: drivers/lightnvm/core.c: In function ‘nvm_get_bb_meta’: drivers/lightnvm/core.c:977: warning: ‘ret’ may be used uninitialized in this function and drivers/nvme/host/lightnvm.c: In function ‘nvme_nvm_get_chk_meta’: drivers/nvme/host/lightnvm.c:580: warning: ‘ret’ may be used uninitialized in this function Indeed, if (for the former) the number of channels or LUNs is zero, or (for both) the passed number of chunks is zero, ret will be returned uninitialized. Fix this by preinitializing ret to zero. Fixes: aff3fb18f957de93 ("lightnvm: move bad block and chunk state logic to core") Fixes: a294c199455187d1 ("lightnvm: implement get log report chunk helpers") Signed-off-by: Geert Uytterhoeven Signed-off-by: Matias Bjørling Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/lightnvm/core.c | 2 +- drivers/nvme/host/lightnvm.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c index efb976a863d2..73ab3cf26868 100644 --- a/drivers/lightnvm/core.c +++ b/drivers/lightnvm/core.c @@ -974,7 +974,7 @@ static int nvm_get_bb_meta(struct nvm_dev *dev, sector_t slba, struct ppa_addr ppa; u8 *blks; int ch, lun, nr_blks; - int ret; + int ret = 0; ppa.ppa = slba; ppa = dev_to_generic_addr(dev, ppa); diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c index a4f3b263cd6c..d64805dc8efb 100644 --- a/drivers/nvme/host/lightnvm.c +++ b/drivers/nvme/host/lightnvm.c @@ -577,7 +577,8 @@ static int nvme_nvm_get_chk_meta(struct nvm_dev *ndev, struct ppa_addr ppa; size_t left = nchks * sizeof(struct nvme_nvm_chk_meta); size_t log_pos, offset, len; - int ret, i, max_len; + int i, max_len; + int ret = 0; /* * limit requests to maximum 256K to avoid issuing arbitrary large -- 2.19.1