From patchwork Tue Aug 10 20:06:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 12429413 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81B6CC432BE for ; Tue, 10 Aug 2021 20:07:02 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 134AC61008 for ; Tue, 10 Aug 2021 20:07:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 134AC61008 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 B18916B0071; Tue, 10 Aug 2021 16:07:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AC6956B0073; Tue, 10 Aug 2021 16:07:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9DCED8D0001; Tue, 10 Aug 2021 16:07:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0053.hostedemail.com [216.40.44.53]) by kanga.kvack.org (Postfix) with ESMTP id 690796B0071 for ; Tue, 10 Aug 2021 16:07:00 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 0F105231BA for ; Tue, 10 Aug 2021 20:07:00 +0000 (UTC) X-FDA: 78460254600.02.FDA4F6A Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf19.hostedemail.com (Postfix) with ESMTP id A81C4B00044D for ; Tue, 10 Aug 2021 20:06:59 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id F218C60EC0; Tue, 10 Aug 2021 20:06:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628626017; bh=dYMLAdLlwEAxyd8jTPoXpFKuKuNTSFdWKtkdKgFw5QU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J9r9SHnOKzunQebZoc7NfQP7ef7ow0SY52KTIUc8l4bbpzZGOraE3n1hWGaZ8/Y6H mQTrN497q3UdoD1kBQ2Uo5MdV0BlzddoXIrqMN4L+SHu4Jbi7BH2iPeRKp7x1ilu99 aZIZ+XWpJgF9r5rHgVHoCRgUl4yWvj3XzrzSed2TJvafiM1R9Jn9QcQmClbczA/vza fInweENoSIUa73c7iyJ5Sr1dtScKMwNjL+cnfqQoD2455YYp6FqFMM3i/tAekdjjDp 6YJoAJ/KVgnZOwFgMQPk/CjT8ppRHF+cTHtinxE4RqC51N8PHcPXG94FnYKT8yrTIf x1NrhU2OuBpYw== From: Nathan Chancellor To: feng.tang@intel.com 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, Nathan Chancellor Subject: [PATCH] mm/hugetlb: Initialize page to NULL in alloc_buddy_huge_page_with_mpol() Date: Tue, 10 Aug 2021 13:06:32 -0700 Message-Id: <20210810200632.3812797-1-nathan@kernel.org> X-Mailer: git-send-email 2.33.0.rc1 In-Reply-To: <20210809024430.GA46432@shbuild999.sh.intel.com> References: <20210809024430.GA46432@shbuild999.sh.intel.com> MIME-Version: 1.0 X-Patchwork-Bot: notify X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: A81C4B00044D Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=J9r9SHnO; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf19.hostedemail.com: domain of nathan@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=nathan@kernel.org X-Stat-Signature: rr78bgf53g8e4rdfxqh6feemwb8wtnoz X-HE-Tag: 1628626019-972874 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/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 --- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) base-commit: 18f73b217b4633e27a61832e1485ce927a8ee5c1 diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 3d9cd2722ea5..604e2d6bd506 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2152,7 +2152,7 @@ static struct page *alloc_buddy_huge_page_with_mpol(struct hstate *h, struct vm_area_struct *vma, unsigned long addr) { - struct page *page; + struct page *page = NULL; struct mempolicy *mpol; gfp_t gfp_mask = htlb_alloc_mask(h); int nid;