Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp884621pxb; Thu, 21 Oct 2021 11:18:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwl0mrcge1YiYX7MMMcLQmd2qEm3sTxjagdTgWspvXwDlYtzFZ73UndYNBewhZ3lVtGFnTw X-Received: by 2002:a17:906:720e:: with SMTP id m14mr9054262ejk.500.1634840301866; Thu, 21 Oct 2021 11:18:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634840301; cv=none; d=google.com; s=arc-20160816; b=vRSMhFFpKPPW5WKE+SZYPOvULxQ1GFKAS1SXJ7Be1IucR1J+VHG2sOBrP3YhOXvtcV lKNHU8+/ELWC7jWSUUyIc+auFhGXzN6fJ3Oju66GQMw4thvHUZCB6WJ0ZNzJM/P5uNhp NYZ+OJvtNDodakCb+bCrxT2S4xFvknOwGHOIRu3JvOSnHXxnDbb6s/owI93rmu+731fb 8JGO8gfaD1+aPuB43z4HhJzmNa0nAciqFlRjvstqm9lCG15uTdOjXA5qoPklVkVIQk/Z dQvqxAfmbAH0rpsCWo58Ooi+2DmoVpRKuoqJGLuHrjuw4TIOZdmxSKRCaIDa1U1SnuPp EhOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Q9NNEUvBDzAqU5rgSV6dqxVQMOi+8V2iWJVj3aQ3oKY=; b=TWcReib/OVUsRm8yGH6fO/BbExa4Vp4RlubXbqL3suN8vT28ZZ0+/111lgUKk2ySu5 K+gAoNGNjHK1zpVUO+oBjJ1APWxhFzUFl3qUhw4/CYeiYQBTY2UiEFpiIPti+RFIGkE8 P7lmVOwoshLqTSa6wZhjUu5HQb35iKjlMSGE+G8/42I/F3zGNoferh5AMP7hwYIRI9q8 rPNMYu1Z4aU/5mTJCE47ciZkgTY5OQftcsm0LbadwMCngLHWy6TLrBFYjSXIxxnTd0bG qfclCCSLsgzvJNtjobRh9oan3SSTQqctBkfC6clduh9WgX5XqXtZvBedvxLoYo0zpoDl +Gzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nv9EroJT; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f12si8040660ejx.695.2021.10.21.11.17.54; Thu, 21 Oct 2021 11:18:21 -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=@gmail.com header.s=20210112 header.b=nv9EroJT; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231770AbhJUSSI (ORCPT + 99 others); Thu, 21 Oct 2021 14:18:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230103AbhJUSSI (ORCPT ); Thu, 21 Oct 2021 14:18:08 -0400 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7991C061764 for ; Thu, 21 Oct 2021 11:15:51 -0700 (PDT) Received: by mail-ed1-x530.google.com with SMTP id r4so34800edi.5 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=FYMtqefX94q9VCJV/s3eRtkwRVnZz/cnc6WBjfx8HQB9qpg9PYpUi1IFcQhd41HsjE lqm9w5UUIkuo4jCZPGhokv3mFPU6wWvv0dOyKzkpJVxz2IUZnq9UL1RsO+zIrtzXyKds 60aRRpWq0nWJGmLP5/1346WGGb5SEDZCr4rTXrZTCLnzDs0Wz1nyGK+UpJnf6VqNW6cH PNnp2oMK68mxmWBR2TxokF8ypqV6BDwqAcRB+Bp47m2jzw8t4kcoiosa1yrS7jVDreQG l0oYM+N4ZSiCWvAZTRhw+wr1rDm6p2u4xYpGJXASloHVZg4eS66Cg+pymicBXE1xJA5K q4Xg== X-Gm-Message-State: AOAM532CaQldRSa+ZrmepB40xhOdfpC5akK23+n+6DrXA3+TIpwmwUx8 /tdG+HWxUTU9YeBm1srTiN5FZ5uapVj3xHEHvuc= 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >