From nobody Tue Feb 10 07:42:51 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1602723667; cv=none; d=zohomail.com; s=zohoarc; b=jz6C55ZH76fEE7D+fZXiNXsEeQ314BfZYUIQQNDhOiLOCd6bPs2T3ArotIVaOv8xL3QMv3ad9do9iOXYxz2Uc6StwsVFQIzkladS2RETvpX1txjTgkOl1x1M+7OdDIHJRTYDujzVA0vmlSy9iJXpCGrEI9sQmmSV+81hz9BKCyk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602723667; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=F3XipHcWdT3DoA+8Q3rpFljVIbmZbys7QErA+57YNGs=; b=RqAgbHe+A7HF2SP6IaqK4Pz9BeacgejmdRjtAwjP5MeX/ZYemPCrhcsZ/LBsza8YnlJHJ12jNvAp0MrRxk1X8uxTSh005JmgHZM6OlSVaDg9+F2UhgSeX4bYmn6V6NMImiyok61T87etOMxgEvEzwxDjDw66cPJzENWHMlCzDSo= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 160272366706194.49708030138947; Wed, 14 Oct 2020 18:01:07 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.7057.18471 (Exim 4.92) (envelope-from ) id 1kSrdT-0004Jv-Ds; Thu, 15 Oct 2020 01:00:51 +0000 Received: by outflank-mailman (output) from mailman id 7057.18471; Thu, 15 Oct 2020 01:00:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kSrdT-0004J9-8p; Thu, 15 Oct 2020 01:00:51 +0000 Received: by outflank-mailman (input) for mailman id 7057; Thu, 15 Oct 2020 01:00:49 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kSrdR-0003ZY-Fu for xen-devel@lists.xenproject.org; Thu, 15 Oct 2020 01:00:49 +0000 Received: from mga01.intel.com (unknown [192.55.52.88]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id b64d8568-93cd-4626-a615-f38165d792c5; Thu, 15 Oct 2020 01:00:45 +0000 (UTC) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 18:00:45 -0700 Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.25]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 18:00:44 -0700 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kSrdR-0003ZY-Fu for xen-devel@lists.xenproject.org; Thu, 15 Oct 2020 01:00:49 +0000 Received: from mga01.intel.com (unknown [192.55.52.88]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id b64d8568-93cd-4626-a615-f38165d792c5; Thu, 15 Oct 2020 01:00:45 +0000 (UTC) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 18:00:45 -0700 Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.25]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 18:00:44 -0700 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: b64d8568-93cd-4626-a615-f38165d792c5 IronPort-SDR: Rari7y453Xph2I6nvivgDgSjF7Xnmm9pgy25ZHIn9Z5icVjSbcgm//I0wUlwfrk4KQeQaZnFZD KjBIkWhnQl4w== X-IronPort-AV: E=McAfee;i="6000,8403,9774"; a="183763644" X-IronPort-AV: E=Sophos;i="5.77,376,1596524400"; d="scan'208";a="183763644" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False IronPort-SDR: FfdsxjRqp3q4f4etEQRl1TI5VTynO18vfKev9t2iOTvW0tZxScWrNfuysGf8rx03gz/Y/v7tG4 l/NGqn36Tp+w== X-IronPort-AV: E=Sophos;i="5.77,376,1596524400"; d="scan'208";a="521643942" Subject: [PATCH 2/2] xen/unpopulated-alloc: Consolidate pgmap manipulation From: Dan Williams To: linux-kernel@vger.kernel.org Cc: Juergen Gross , Stefano Stabellini , Andrew Morton , xen-devel@lists.xenproject.org, Boris Ostrovsky , vishal.l.verma@intel.com, dave.hansen@linux.intel.com, akpm@linux-foundation.org, linux-nvdimm@lists.01.org, linux-mm@kvack.org Bcc: dan.j.williams@intel.com Date: Wed, 14 Oct 2020 17:42:14 -0700 Message-ID: <160272253442.3136502.16683842453317773487.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <160272252400.3136502.13635752844548960833.stgit@dwillia2-desk3.amr.corp.intel.com> References: <160272252400.3136502.13635752844548960833.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Cleanup fill_list() to keep all the pgmap manipulations in a single location of the function. Update the exit unwind path accordingly. Link: http://lore.kernel.org/r/6186fa28-d123-12db-6171-a75cb6e615a5@oracle.= com Cc: Juergen Gross Cc: Stefano Stabellini Cc: Andrew Morton Cc: Reported-by: Boris Ostrovsky Signed-off-by: Dan Williams --- drivers/xen/unpopulated-alloc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/xen/unpopulated-alloc.c b/drivers/xen/unpopulated-allo= c.c index 8c512ea550bb..75ab5de99868 100644 --- a/drivers/xen/unpopulated-alloc.c +++ b/drivers/xen/unpopulated-alloc.c @@ -27,11 +27,6 @@ static int fill_list(unsigned int nr_pages) if (!res) return -ENOMEM; =20 - pgmap =3D kzalloc(sizeof(*pgmap), GFP_KERNEL); - if (!pgmap) - goto err_pgmap; - - pgmap->type =3D MEMORY_DEVICE_GENERIC; res->name =3D "Xen scratch"; res->flags =3D IORESOURCE_MEM | IORESOURCE_BUSY; =20 @@ -43,6 +38,11 @@ static int fill_list(unsigned int nr_pages) goto err_resource; } =20 + pgmap =3D kzalloc(sizeof(*pgmap), GFP_KERNEL); + if (!pgmap) + goto err_pgmap; + + pgmap->type =3D MEMORY_DEVICE_GENERIC; pgmap->range =3D (struct range) { .start =3D res->start, .end =3D res->end, @@ -91,10 +91,10 @@ static int fill_list(unsigned int nr_pages) return 0; =20 err_memremap: - release_resource(res); -err_resource: kfree(pgmap); err_pgmap: + release_resource(res); +err_resource: kfree(res); return ret; }