From mboxrd@z Thu Jan 1 00:00:00 1970 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 A3CEAC433FE for ; Thu, 21 Oct 2021 18:15:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 318E261AA5 for ; Thu, 21 Oct 2021 18:15:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 318E261AA5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 8105C6B006C; Thu, 21 Oct 2021 14:15:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7BF65900002; Thu, 21 Oct 2021 14:15:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6AE9B6B0073; Thu, 21 Oct 2021 14:15:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0060.hostedemail.com [216.40.44.60]) by kanga.kvack.org (Postfix) with ESMTP id 5AC786B006C for ; Thu, 21 Oct 2021 14:15:53 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 0F93E1801492F for ; Thu, 21 Oct 2021 18:15:52 +0000 (UTC) X-FDA: 78721248144.15.DA43CDE Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) by imf28.hostedemail.com (Postfix) with ESMTP id AA19490000A4 for ; Thu, 21 Oct 2021 18:15:51 +0000 (UTC) Received: by mail-ed1-f44.google.com with SMTP id d3so2404163edp.3 for ; Thu, 21 Oct 2021 11:15:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Q9NNEUvBDzAqU5rgSV6dqxVQMOi+8V2iWJVj3aQ3oKY=; b=nv9EroJTTxrn/o7mKYWO9w+oiLv84EbZZutE8W8+F9IFgc2IoBCtNgAG8HUSHUcI+X VpE29sR4w2taDr21Z35NF+ya8sJ/khziw1/kc+eU6wyGqEyknCKpCi+LnZQ4JIpE1n9d DliDZ5aUdqgzUzPt8a7gHTb5pXiRpAOkrudS7vZntoOZdzGTLg5RW3qG6PUJ8uc7i5R2 Ul1Smvkv+lsf12BZkSq57iy54+ZBm14sl8d1jWLq+hBkSnqXp5S9N767C3CT6hkphtRF zadBKAZg1TpnedXoelYngmAlQc45Kiyet27ogqKVxGrbKXRv1zjXxR+DtBSreEpJM8aA uxPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Q9NNEUvBDzAqU5rgSV6dqxVQMOi+8V2iWJVj3aQ3oKY=; b=7b/Af7VZPG4R8jIhDNL0gwfi1CZia4WkF9vzX3a1dSw1Zhf1ooXbPNUdIPb6Jh3OJq K4oly7EaRdr8xCf4M9GIraPrwdsP+YtbxFgxNL9uFypiMCTyf2saGtoeqUQz55Y1tzfM OJ49Sel334VKHFLg+0AxTOYFlzAhSwCkT0HdDg1wHzxPO55/ivNBYonuY1EMB6BBZcEM U3TqE+Ph8WbRVadus4KITYtT7l3dYFs8TpEA1IaBBev51rwRN3S19Vzv1FSj68b0NCM7 XIWJ7VAmHQMnQTpbuOdMAGqTww43jVUwwfgb7lsk0p339epEdorwvYNJcSb19AjsRhHQ 4EHQ== X-Gm-Message-State: AOAM530VkiqlfVNPUdxkjQQ9AFU4V+A9C4YsxzCnLSdAztYwezf//Jx9 /pRN3IAidmaABXAtRk1zijljI7ZxXtCceYyvA0w= X-Google-Smtp-Source: ABdhPJySDQmHjwpv9clbcU76avoNolSyYIlTeXMXkiBpRXvMzcuTtqKZ2cuydVL16LYyfT5n5aCAak6s6Vii721VUos= X-Received: by 2002:a17:906:3f83:: with SMTP id b3mr9133374ejj.233.1634840150067; Thu, 21 Oct 2021 11:15:50 -0700 (PDT) MIME-Version: 1.0 References: <20211021180336.2328086-1-nathan@kernel.org> In-Reply-To: <20211021180336.2328086-1-nathan@kernel.org> From: Yang Shi Date: Thu, 21 Oct 2021 11:15:38 -0700 Message-ID: Subject: Re: [PATCH] mm/memory_failure: Initialize extra_pins in me_pagecache_clean() To: Nathan Chancellor Cc: Naoya Horiguchi , Andrew Morton , Nick Desaulniers , Linux MM , Linux Kernel Mailing List , llvm@lists.linux.dev, "kernelci.org bot" Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: AA19490000A4 X-Stat-Signature: jjrqdwrm9u1abezy1q71cjf35rke6fzw Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=nv9EroJT; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf28.hostedemail.com: domain of shy828301@gmail.com designates 209.85.208.44 as permitted sender) smtp.mailfrom=shy828301@gmail.com X-HE-Tag: 1634840151-300624 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: On Thu, Oct 21, 2021 at 11:04 AM Nathan Chancellor wrote: > > 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. Thanks for catching this. Acked-by: Yang Shi > > 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 >