Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp4039871pxt; Tue, 10 Aug 2021 18:23:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyE13Tf8PE4cLugp21oGM/Hd/QDFRC9004lTl5LdLHl0h4DWB+gghA9iZ4qfV15tWiCVeEx X-Received: by 2002:a05:6402:215:: with SMTP id t21mr8358226edv.68.1628645020265; Tue, 10 Aug 2021 18:23:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628645020; cv=none; d=google.com; s=arc-20160816; b=UuJMuKbBp1XlP77SeBnOoIy22O/ocdMZX/TsYYsDY0cyd4btBH1SEL25mSIsYM7JGM DOzgrnMTbEzGgghrGk9cOhkuWZPqaZHRDs9/kAoNkhygYfA14k8D3ZM5Nywz8rsZxpAH B9DjHQS8LkIRQ4BK8Awzj2Ki0e7Pf16gbTEzKXYPOloNGRBbBC1NueGHbOGb9SHbMM1r Jl5I6hCNvhOHCfRF/Rom9n+aoG8NZuGDsdQad5Y0/Pbs2offc+UF7XByqYjlasV1q5Bo S8Qpz0tcRgoUxPSWQTGUaXKkm6JGJ9hNzsOdUiQ0+Mko05ssy/AVW9/l7JGOaVoQV+0/ FbBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=k/Ug7Gvgvd5B1rCVyZwp5xaQulrjJqz//a2wucsBRvI=; b=M/io+VdLUKwGGEdQLsjRF/2tyipKMPA03GujnABni6jj3SOiB4MqNCt07d6k1Kf+tm 534FUR13Cagv2UpbtsDh+Ft+XZ/kiax/qoCrpwNYTw37/BECdm2vstnjSPUAG070ac+a 4/lWWShlmetewvTQ8oX5cS6tHDwE/tPpEOvNJVSR9p2S5m+h3e6Dj+9Dh9P62Ab43Aec UTUwJ9TWymuSXKLiuwPfJVkzgYPIsa0nwRd5oTZzmBtbxyiBrgDo0yzFq8eaAOkKxkR6 3X+sYQsrzrF4FkXNpsXgmQHu+MxLRz3xRAX6Gre0pnOWLK+r/J6IR0x7vNGQQRGIpBH5 FYgw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cm14si22135004edb.499.2021.08.10.18.23.16; Tue, 10 Aug 2021 18:23:40 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229816AbhHKBWU (ORCPT + 99 others); Tue, 10 Aug 2021 21:22:20 -0400 Received: from mga03.intel.com ([134.134.136.65]:57421 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbhHKBWT (ORCPT ); Tue, 10 Aug 2021 21:22:19 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10072"; a="215055623" X-IronPort-AV: E=Sophos;i="5.84,311,1620716400"; d="scan'208";a="215055623" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Aug 2021 18:21:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,311,1620716400"; d="scan'208";a="516260061" Received: from shbuild999.sh.intel.com (HELO localhost) ([10.239.146.151]) by FMSMGA003.fm.intel.com with ESMTP; 10 Aug 2021 18:21:50 -0700 Date: Wed, 11 Aug 2021 09:21:49 +0800 From: Feng Tang To: Nathan Chancellor Cc: aarcange@redhat.com, ak@linux.intel.com, akpm@linux-foundation.org, ben.widawsky@intel.com, dan.j.williams@intel.com, dave.hansen@intel.com, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, mgorman@techsingularity.net, mhocko@suse.com, mike.kravetz@oracle.com, rdunlap@infradead.org, rientjes@google.com, vbabka@suse.cz, ying.huang@intel.com Subject: Re: [PATCH] mm/hugetlb: Initialize page to NULL in alloc_buddy_huge_page_with_mpol() Message-ID: <20210811012149.GA2474@shbuild999.sh.intel.com> References: <20210809024430.GA46432@shbuild999.sh.intel.com> <20210810200632.3812797-1-nathan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210810200632.3812797-1-nathan@kernel.org> User-Agent: Mutt/1.5.24 (2015-08-30) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 10, 2021 at 01:06:32PM -0700, Nathan Chancellor wrote: > Clang warns: > > mm/hugetlb.c:2162:6: warning: variable 'page' is used uninitialized > whenever 'if' condition is false [-Wsometimes-uninitialized] > if (mpol_is_preferred_many(mpol)) { > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > mm/hugetlb.c:2172:7: note: uninitialized use occurs here > if (!page) > ^~~~ > mm/hugetlb.c:2162:2: note: remove the 'if' if its condition is always > true > if (mpol_is_preferred_many(mpol)) { > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > mm/hugetlb.c:2155:19: note: initialize the variable 'page' to silence > this warning > struct page *page; > ^ > = NULL > 1 warning generated. > > Initialize page to NULL like in dequeue_huge_page_vma() so that page is > not used uninitialized. > > Signed-off-by: Nathan Chancellor Thanks for the catch! In my original patch, I initialized it in one function, but overlooked this one. Thanks, Feng