From patchwork Fri Sep 16 07:22:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12978214 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 A66B9C54EE9 for ; Fri, 16 Sep 2022 07:23:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9DBD98000D; Fri, 16 Sep 2022 03:23:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8C3B38000C; Fri, 16 Sep 2022 03:23:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 684028000D; Fri, 16 Sep 2022 03:23:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 1EE8180009 for ; Fri, 16 Sep 2022 03:23:47 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 00B32AC634 for ; Fri, 16 Sep 2022 07:23:47 +0000 (UTC) X-FDA: 79917108894.12.135AB52 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf14.hostedemail.com (Postfix) with ESMTP id 9CF141000AF for ; Fri, 16 Sep 2022 07:23:45 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MTQSG0DwrzlVhh; Fri, 16 Sep 2022 15:19:42 +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.31; Fri, 16 Sep 2022 15:23:41 +0800 From: Miaohe Lin To: , , , CC: , , , Subject: [PATCH v2 13/16] mm/page_alloc: init local variable buddy_pfn Date: Fri, 16 Sep 2022 15:22:54 +0800 Message-ID: <20220916072257.9639-14-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220916072257.9639-1-linmiaohe@huawei.com> References: <20220916072257.9639-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=none; spf=pass (imf14.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663313026; a=rsa-sha256; cv=none; b=JPs3vHtHbNFebvfFXLRXvZTgv7pyUODxRT8Jj6vv9YKZx4VmvblGcKGj7E1OL+4UbWwl7A 5Mi8sDgi5D9XpOkurhuKdbQ5pB4Wy3M40x2vQghoJS7qpxN8mKsfBZcnRqugbxvy8+2nrs J96LDIeX3KzjZ7JLT6/dfrPjBkzp1lA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663313026; 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=QNF1FU2AkhLK6sqO5FOxUtr8IXW6zKvUSQIsR1Q9c0I=; b=UR0KYAPrl/W/KqdtrQSfJwNffKbq8hM+B+8+cxmlicpqkfALk93j8auYLde7I22p8VW+4K mgUw8ZJ+4tH28RCQTm8DNQPR3uHRivV/9riyAPKJq3hv2KUL64dRauu/GWvLlwqZ8xVUqx fXGWs4kEYoSz6pJOsyBd9XWHkovbPoI= X-Rspamd-Queue-Id: 9CF141000AF X-Rspam-User: Authentication-Results: imf14.hostedemail.com; dkim=none; spf=pass (imf14.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Stat-Signature: w4h1p97wsrwy147mm9jmb5xkurndo8oc X-Rspamd-Server: rspam04 X-HE-Tag: 1663313025-822667 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 67ec8a2e1db2..652b3d766003 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;