From patchwork Fri Jul 16 21:03:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nico Pache X-Patchwork-Id: 12382853 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=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 72DE6C12002 for ; Fri, 16 Jul 2021 21:04:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 09A2061285 for ; Fri, 16 Jul 2021 21:04:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 09A2061285 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 582838D00F4; Fri, 16 Jul 2021 17:04:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 559728D00EC; Fri, 16 Jul 2021 17:04:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 448E48D00F4; Fri, 16 Jul 2021 17:04:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0219.hostedemail.com [216.40.44.219]) by kanga.kvack.org (Postfix) with ESMTP id 23F7D8D00EC for ; Fri, 16 Jul 2021 17:04:03 -0400 (EDT) Received: from smtpin37.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id E3DFD18150C4B for ; Fri, 16 Jul 2021 21:04:01 +0000 (UTC) X-FDA: 78369678282.37.7F1E149 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf19.hostedemail.com (Postfix) with ESMTP id 7D79DB000452 for ; Fri, 16 Jul 2021 21:04:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626469440; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=g49/KyQBA3eOY1MbjSChZGxyqJEiIAVE2IDAbe+zWxU=; b=Ke/cS3VWlFPie+biAJSljeTuIgKpArhkatHoKD2hcA9JU2gxoICojpTeVhZftGceWi5un1 593rBTdq0GcfU7GSMut7YUzdZxHncZ90Bq9JygPqe58eQl+oWcvgGbqcyhPE92e+ssLh7T 8h96/ZsSl16CgiAArnFiP3Exqf59DHc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-443-YiEPTyHiN8W-0bgFWdGPLQ-1; Fri, 16 Jul 2021 17:03:47 -0400 X-MC-Unique: YiEPTyHiN8W-0bgFWdGPLQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 37C021804877; Fri, 16 Jul 2021 21:03:46 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-107.rdu2.redhat.com [10.10.116.107]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2F9CB60C05; Fri, 16 Jul 2021 21:03:42 +0000 (UTC) From: Nico Pache To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: rppt@kernel.org, akpm@linux-foundation.org, npache@redhat.com, aquini@redhat.com Subject: [PATCH] Fix 'zone_id' may be used uninitialized in this function warning Date: Fri, 16 Jul 2021 17:03:36 -0400 Message-Id: <20210716210336.1114114-1-npache@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="Ke/cS3VW"; spf=none (imf19.hostedemail.com: domain of npache@redhat.com has no SPF policy when checking 216.205.24.124) smtp.mailfrom=npache@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam05 X-Stat-Signature: 63xn1he6w3dr4dpgsorqjxymos1g7in9 X-Rspamd-Queue-Id: 7D79DB000452 X-HE-Tag: 1626469441-512363 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: When compiling with -Werror, cc1 will warn that 'zone_id' may be used uninitialized in this function warning. Initialize the zone_id as 0. Its safe to assume that if the code reaches this point it has at least one numa node with memory, so no need for an assertion before init_unavilable_range. Fixes: 122e093c1734 ("mm/page_alloc: fix memory map initialization for descending nodes") Signed-off-by: Nico Pache --- 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 3e97e68aef7a..3f3116f52fd8 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6719,7 +6719,7 @@ static void __init memmap_init(void) { unsigned long start_pfn, end_pfn; unsigned long hole_pfn = 0; - int i, j, zone_id, nid; + int i, j, zone_id = 0, nid; for_each_mem_pfn_range(i, MAX_NUMNODES, &start_pfn, &end_pfn, &nid) { struct pglist_data *node = NODE_DATA(nid);