Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp873749pxb; Thu, 21 Oct 2021 11:06:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwY9lkSdPqIiQtTuCgzM/HgkFoA8hO1y3SvxZheRGY+qrXhE+8IzQWExDZ5qRC7Gn216L7+ X-Received: by 2002:a17:90b:2248:: with SMTP id hk8mr8288411pjb.102.1634839570887; Thu, 21 Oct 2021 11:06:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634839570; cv=none; d=google.com; s=arc-20160816; b=canB0pIGNWpxRmsgFzXg4uBv2TbaizRlG/ORZpCMPT7N/JccYKYVRb71mpHwF7t280 RolSLFz4mQCSGek9zkzmXh2/BodbOBJWNCIgz8GNGgEbdi18omlNvehfbMpcMpbDKaNT MoWEn1K7C0wUWMV05wvfcJWBL+ePDawCdMJ3yCvTXAOxXdDyA5Ra1UlXP8Z7XmB3BJJ5 twuGLJD56f23Aw04v3MCpH0PX4ui3dKHUjitAtNCe76SIPScaeY+O5kKLJkWMNJly3uh 2KK6r9OSVKe65+942TIQHGJY10XBxiI17e1+xHnsiatrWD92HDTFG+S+aYb/HRfuEjNr t1UA== 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=YngheKrd4+rLhU0CnLGOGfbBw7t1T9IMwetjN1LrmIc=; b=xYEks5s1GqoLYrkuyXyJLYcqT+jirZOAFpqNTdrQR+bAAbL0Dp/lKyHsoOBxfm10cg rACpYSLN/1sO8MRoZx/T6LWmpHgQJeYBmPfL4LS343F9ef1kpKhvfA9jqpG6b6AWP4w3 RYqBLa5YlnLNGsrVDr39/t8/NfC3P0z7SLyRG4+4Lx1KKmrrsdHHm+nvyoXVuh9fCwmg VFZkRM7XOnxml22Lv5Jy2UFQ0V7tg+ytobU1pcZZzsHyKetXziYTeEWLFwwsefjsrI4X w68+t4WThn1YZW45cbx9WHUCeeR0mzOhn9G+VdeIw9Qsq/5DYo+OcJhEQ4D3lXKgwNAz ECag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EEj3xxBa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nl15si9392389pjb.39.2021.10.21.11.05.55; Thu, 21 Oct 2021 11:06:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EEj3xxBa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S232570AbhJUSHG (ORCPT + 99 others); Thu, 21 Oct 2021 14:07:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:49854 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232698AbhJUSGw (ORCPT ); Thu, 21 Oct 2021 14:06:52 -0400 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); -- 2.33.1.637.gf443b226ca