Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1093367iob; Wed, 4 May 2022 14:34:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqwzdNrFIHGrPIbZ1ZQwtrcnUa5dkvdoaR+ErQgyZ3u4eQbfkeWRLHGEpYh8c2vL3FHhZZ X-Received: by 2002:a63:82c2:0:b0:3c2:8bd5:7238 with SMTP id w185-20020a6382c2000000b003c28bd57238mr7080461pgd.440.1651700046326; Wed, 04 May 2022 14:34:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651700046; cv=none; d=google.com; s=arc-20160816; b=Moi4XRHr5hrJkxyVCNgucGkeAo6pbFes6r2jXNS3LEJtbqjPbLGQJJylvy3JPXCEcf VqjWAmiU8RiBavJVp3wPpFO1fjB17WX5EPvKhEOb/GA2qAvajWrAiur0Y0rvhmhooRWg pwGiMerGo+yYrd26c+0RDi9I2MjIl/9pM9j+pFeRrgdiUg1pUnpEmDb4bcNSZ5E597LZ R4ow3l2azN6QsSn1yA5tVF7gMyHyDeUzHtGshCNgPpaZtX51t3tpD56xXUWL4B/1QxpD 2vAL5c4W3UryCk1T2LlVlh0WzRzdD1Y667oGcK9VVBzjQxGMJ5FRkkuME2L0sfoeLPtI Vxhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=B2yB0lze7BEuTrRpZk5LRm5sSwxvXQHZiQbbv6ssp/M=; b=EV17mriMvDVRffpxzsP/EeaAyyYXZUoDfqL2xxV1wSjY3pFeS3cBv2ufuIVb4mGG+7 I1Nuz+IG0aWJkI3O+VZ58cKeqjLQl3c3N7SHzC08+CoBkVUUQrPcAkY2r1y+LUdGnGky vPlvI5WhDhchTRQHfLm/C96vmL22YSdPVvCSEMWOk82BjIgD3SjtRNgVROkwEzsU0f4W y83f9BoN+twoBpEk0gmWFgj4pgu9w7bQboc7NWrZA0k2RLLjG9hqty3d4YaTeDTMj86E /KFq+YSA6MtYS5bYFiPA9wMQwdXvYw6tI/hz6csmJHf6UiCwif2A9Jf16B0U33ftcDhY J+eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=egta3cRz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga18-20020a17090b039200b001d988ce211asi5706764pjb.51.2022.05.04.14.33.50; Wed, 04 May 2022 14:34:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=egta3cRz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241243AbiEDFAu (ORCPT + 99 others); Wed, 4 May 2022 01:00:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237376AbiEDFAq (ORCPT ); Wed, 4 May 2022 01:00:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F80E2D1E0 for ; Tue, 3 May 2022 21:57:11 -0700 (PDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id F1132B82280 for ; 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.25.1