From patchwork Wed May 4 04:57:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 12837116 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC80EC433F5 for ; Wed, 4 May 2022 04:57:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 26D246B0071; Wed, 4 May 2022 00:57:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 21C996B0073; Wed, 4 May 2022 00:57:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 10BC16B0074; Wed, 4 May 2022 00:57:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id F404B6B0071 for ; Wed, 4 May 2022 00:57:10 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id B986E29670 for ; Wed, 4 May 2022 04:57:10 +0000 (UTC) X-FDA: 79426851420.15.8081BC3 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf07.hostedemail.com (Postfix) with ESMTP id 217B94007B for ; Wed, 4 May 2022 04:57:06 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 528856077B; Wed, 4 May 2022 04:57:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57F49C385A4; Wed, 4 May 2022 04:57:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651640228; bh=Ra0JCiuxWndPnvcreZb9EXKE6gp8u/jrYNK0AnIc3iY=; h=From:To:Cc:Subject:Date:From; b=egta3cRzvh6HRsQFORg0Nd5GutCLf5F2+mjBTg+O55ToxXPHeXLi0n4i1rRr/4Nxu rrcVHvyk1EXuk2nXHaBxF/1pyucJyucjBMcw9lAfNlvk4F/2doZA7spoZYXumRYQYG Mgi0Dm4JhuYx3QMiVWd2al6SEosTFuMC05qy728TeIcS6NXNg6rRVL6oeKUK70E+xC eLIT3AdZgtperToGmsJmFSaqfttD/3ycgCrXteHpPUUZzIMOXBaFqfzsF+hNIIdeXi PrHS+GVGsPps3d1Y2mvnBu0H14RYo0STqrBMqdBxX4o2yda81KU1jEX+PdRNC3buzK mkZNfVLsXBZfQ== From: SeongJae Park To: willy@infradead.org, akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, SeongJae Park Subject: [PATCH] mm/shmem/shmem_swapin_folio(): Fix uninitialized use of folio Date: Wed, 4 May 2022 04:57:04 +0000 Message-Id: <20220504045704.105803-1-sj@kernel.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=egta3cRz; spf=pass (imf07.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Rspam-User: X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 217B94007B X-Stat-Signature: nncpc9syte567shxnhi6p1fhi3o5nyhx X-HE-Tag: 1651640226-367785 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Commit 2b58b3f33ba2 ("mm/shmem: convert shmem_swapin_page() to shmem_swapin_folio()") in 'mm-unstable' tree introduces uninitialized variable access as below when 'shmem_swapin_folio()' goes to 'failed' path early. This commit fixes it. linux/mm/shmem.c: In function ‘shmem_swapin_folio.isra.0’: linux/mm/shmem.c:1761:5: warning: ‘folio’ is used uninitialized in this function [-Wuninitialized] 1761 | if (folio) { | ^ Fixes: 2b58b3f33ba2 ("mm/shmem: convert shmem_swapin_page() to shmem_swapin_folio()") Signed-off-by: SeongJae Park --- mm/shmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/shmem.c b/mm/shmem.c index 820fde6c2ef6..6a18641a90ff 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1682,7 +1682,7 @@ static int shmem_swapin_folio(struct inode *inode, pgoff_t index, struct shmem_inode_info *info = SHMEM_I(inode); struct mm_struct *charge_mm = vma ? vma->vm_mm : NULL; struct page *page; - struct folio *folio; + struct folio *folio = NULL; swp_entry_t swap; int error;