From patchwork Thu Oct 21 18:03:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 12576023 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E6FDC433EF for ; Thu, 21 Oct 2021 18:04:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 33CE661A70 for ; Thu, 21 Oct 2021 18:04:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 33CE661A70 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id B9EE86B006C; Thu, 21 Oct 2021 14:04:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B27BF6B0071; Thu, 21 Oct 2021 14:04:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A195A6B0073; Thu, 21 Oct 2021 14:04:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 910546B006C for ; Thu, 21 Oct 2021 14:04:35 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id ED0501802296C for ; Thu, 21 Oct 2021 18:04:34 +0000 (UTC) X-FDA: 78721219668.08.F1650E8 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf08.hostedemail.com (Postfix) with ESMTP id 2742430000AA for ; Thu, 21 Oct 2021 18:04:30 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id D20F1619EE; Thu, 21 Oct 2021 18:04:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634839473; bh=lGh0XeqSZNuW0fqplNWzUDedNwAXO4pvwLSl9pHgoZY=; h=From:To:Cc:Subject:Date:From; b=EEj3xxBawH/cZAnovGxNz2vMTaV3p3XTSa1IEaFTRbJMsCDVlO1XuCMHbnIlbmzuV veDGmUuPOiqTCCiAld06Qt/6f4IEUK8GjEZdjGjrW7prpQv3bJ4pNi8ZeQFvPzl1/V U66JnX8qMzz+MnefSv3dQVp/it/IMRivlzi1wx2mWNRKliC6FpgMz6iYVRQATKep48 nb8w3cc+R41alXXuncus9UpMV8kKBncmT9LLfMAZf+CbDpqv5sf8irj/7oUXlW8dzv XUGNoJFj4R3BHfz8qOuzjvFIZXtrLDJHJAnSORRPVDE11HBbkyDWUF7RtY4G/Qfkq1 MSZ7Jq5oMC8bw== From: Nathan Chancellor To: Naoya Horiguchi , Andrew Morton Cc: Nick Desaulniers , Yang Shi , linux-mm@kvack.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Nathan Chancellor , "kernelci.org bot" Subject: [PATCH] mm/memory_failure: Initialize extra_pins in me_pagecache_clean() Date: Thu, 21 Oct 2021 11:03:37 -0700 Message-Id: <20211021180336.2328086-1-nathan@kernel.org> X-Mailer: git-send-email 2.33.1.637.gf443b226ca MIME-Version: 1.0 X-Patchwork-Bot: notify X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 2742430000AA X-Stat-Signature: s6znr9ayq5ih5fsnpo4io3qfyfbfgujm Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=EEj3xxBa; spf=pass (imf08.hostedemail.com: domain of nathan@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=nathan@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-HE-Tag: 1634839470-470355 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: Clang warns: mm/memory-failure.c:892:6: error: variable 'extra_pins' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized] if (!mapping) { ^~~~~~~~ mm/memory-failure.c:915:32: note: uninitialized use occurs here if (has_extra_refcount(ps, p, extra_pins)) ^~~~~~~~~~ mm/memory-failure.c:892:2: note: remove the 'if' if its condition is always false if (!mapping) { ^~~~~~~~~~~~~~~ mm/memory-failure.c:879:6: error: variable 'extra_pins' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized] if (PageAnon(p)) { ^~~~~~~~~~~ mm/memory-failure.c:915:32: note: uninitialized use occurs here if (has_extra_refcount(ps, p, extra_pins)) ^~~~~~~~~~ mm/memory-failure.c:879:2: note: remove the 'if' if its condition is always false if (PageAnon(p)) { ^~~~~~~~~~~~~~~~~~ mm/memory-failure.c:871:17: note: initialize the variable 'extra_pins' to silence this warning bool extra_pins; ^ = 0 2 errors generated. Initialize extra_pins to false so that it is not used uninitialized. Fixes: d882a43a0011 ("mm: shmem: don't truncate page if memory failure happens") Link: https://github.com/ClangBuiltLinux/linux/issues/1487 Reported-by: "kernelci.org bot" Signed-off-by: Nathan Chancellor --- I am aware the fixes tag is not stable. It is there to convey this should be squashed into mm-shmem-dont-truncate-page-if-memory-failure-happens.patch. mm/memory-failure.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 3b04f0361a58..dba5f0098165 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -868,7 +868,7 @@ static int me_pagecache_clean(struct page_state *ps, struct page *p) { int ret; struct address_space *mapping; - bool extra_pins; + bool extra_pins = false; delete_from_lru_cache(p);