From patchwork Fri Sep 9 09:24:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12971381 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57465ECAAD3 for ; Fri, 9 Sep 2022 09:25:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 05423940010; Fri, 9 Sep 2022 05:25:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E84EF94000E; Fri, 9 Sep 2022 05:25:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C38F494000D; Fri, 9 Sep 2022 05:25:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 96A988D000C for ; Fri, 9 Sep 2022 05:25:34 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 7968F40A46 for ; Fri, 9 Sep 2022 09:25:34 +0000 (UTC) X-FDA: 79892014188.29.EB46645 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf30.hostedemail.com (Postfix) with ESMTP id DDB6C800A3 for ; Fri, 9 Sep 2022 09:25:33 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MP9TS02pRzZcmJ; Fri, 9 Sep 2022 17:21:00 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 9 Sep 2022 17:25:31 +0800 From: Miaohe Lin To: CC: , , , , Subject: [PATCH 13/16] mm/page_alloc: init local variable buddy_pfn Date: Fri, 9 Sep 2022 17:24:48 +0800 Message-ID: <20220909092451.24883-14-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220909092451.24883-1-linmiaohe@huawei.com> References: <20220909092451.24883-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662715534; a=rsa-sha256; cv=none; b=x9v78DsOrz+ombeb2Fj9PKoraOUazrV/N3nOb/Kd+F6kUWqKtiNtG/rvp0JEb6hGfoBtv3 7i0uJZFSyIyGHQvovri+pzHGVpGaYQXWM4c5R2jPeLcq76y4sJJxiPdWjacT8IGJICLajG F+W50gsNo1eaQqLRz9yoq6nzuEEhFlo= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf30.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662715534; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lGorzbx2/799i8C3hn9fMwaX24G2PgzNoWDpcLkVKzc=; b=BH4YFqsvXxmEOxTLyOtOGPs65vAY8sQc7Ow/AxLgzRWk2awzBMUiDye87ypYGfIaZc9v2Z h/0J0qHfBFTcZK3m9Kbysy6cm6GkZ6Kk+r6sUOKLP51OtR2ZwbcF1swQBQNqz2q2G7f/DT xS1uv1YiQz4tlchYsNayAWSthDXGaV4= Authentication-Results: imf30.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf30.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Rspam-User: X-Rspamd-Queue-Id: DDB6C800A3 X-Rspamd-Server: rspam09 X-Stat-Signature: obqki3rd44x4zt1tit565k3sse83h638 X-HE-Tag: 1662715533-479637 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: The local variable buddy_pfn could be passed to buddy_merge_likely() without initialization if the passed in order is MAX_ORDER - 1. This looks buggy but buddy_pfn won't be used in this case as there's a order >= MAX_ORDER - 2 check. Init buddy_pfn to 0 anyway to avoid possible future misuse. Signed-off-by: Miaohe Lin Reviewed-by: David Hildenbrand Reviewed-by: Anshuman Khandual Reviewed-by: Oscar Salvador --- mm/page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index e1c7f98cff96..63ad25e86010 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1113,7 +1113,7 @@ static inline void __free_one_page(struct page *page, int migratetype, fpi_t fpi_flags) { struct capture_control *capc = task_capc(zone); - unsigned long buddy_pfn; + unsigned long buddy_pfn = 0; unsigned long combined_pfn; struct page *buddy; bool to_tail;