From patchwork Tue Mar 19 02:30:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souptick Joarder X-Patchwork-Id: 10858751 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A1D06139A for ; Tue, 19 Mar 2019 02:28:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 86CE029470 for ; Tue, 19 Mar 2019 02:28:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7945829500; Tue, 19 Mar 2019 02:28:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2AECC29470 for ; Tue, 19 Mar 2019 02:28:00 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1h64SJ-00071r-JJ; Tue, 19 Mar 2019 02:26:19 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1h64SI-00071k-NJ for xen-devel@lists.xenproject.org; Tue, 19 Mar 2019 02:26:18 +0000 X-Inumbo-ID: 5fb52d7b-49ee-11e9-bc90-bc764e045a96 Received: from mail-pf1-x442.google.com (unknown [2607:f8b0:4864:20::442]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 5fb52d7b-49ee-11e9-bc90-bc764e045a96; Tue, 19 Mar 2019 02:26:17 +0000 (UTC) Received: by mail-pf1-x442.google.com with SMTP id 8so9200199pfr.4 for ; Mon, 18 Mar 2019 19:26:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=F9hIq6OqtC1SVS2O3U7ZkPoLnNclA70DsapCWy7Q+lE=; b=axQ01i8IBZi45x8kocMbwsCnxyGWV2J6KPZD0Kvgs2/Yaw/Le0kbKh4v6TjS8TlLN/ Fp1i11g2wUSy9AxXfQGRlmcKVs6D+8q5JgaGppoXZDWZ6E08ke8uQygcG2EGAEoCtGsx UFLiaLRZlpLGEKiubhXWZ/PmRqC3+92ojBfVO/yWdt0kFn/ZAPUhGKykq5XnL7GFNyle wwduJrwn8QRqkDXVKxcrG+gP4/1dGOKT1a0MvDM0uxgedBI0PBb86jSFen+JBmyPEcp5 OtUtOsoojCEt6asjiBR1//iQ0mQm9kT1vJjSfz2yiTcGpUHiyQD6dTVTpKpFvR5WdtUP RHDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=F9hIq6OqtC1SVS2O3U7ZkPoLnNclA70DsapCWy7Q+lE=; b=NQvmOHoj7QWoTflJue/R/nQ8dzyGdG2RhFORZoptlBJcMt38Nl7DUcWzA5VlStSKr5 jsSDdHiARhLNhkdNXScztIXPonojssbNeety9Yex/YqHIM4Xqbuv+yVWR3y0OfL7WdxX qy4k3dNSgx2gBEGRjdNLf3bbBa9ixwQmScKC+r8fmJS0tk7+RgpvUdLZGGANmO/EUSdE l17GF/SmIIsbXe1BcTLRVn3dkrselttpG5wP6/4ny6Bo/X0s8jGUBiTpg1/+aOLj7fK4 0C5+HlOhpKSE8wdQxa7JzvJfJWW1h/49uqUuYINCEbrxtPMNNnijYWn2ttxEX+cNKJwj 2qZw== X-Gm-Message-State: APjAAAX5BxfhDdNUgrqCD7hngilB7JNmRVR92hclRYEe8PHmikhax8HS zqin9wwmKW+KOa0dWmrW1G0= X-Google-Smtp-Source: APXvYqzT+r2qSiocZjhBB5Mm80gaR6+7Ywju7MjSzVTtt6VaSEqofhbQuEZfX4U+yLgEjsULEq7Ykw== X-Received: by 2002:a63:f74c:: with SMTP id f12mr75210pgk.124.1552962376538; Mon, 18 Mar 2019 19:26:16 -0700 (PDT) Received: from jordon-HP-15-Notebook-PC ([106.51.22.39]) by smtp.gmail.com with ESMTPSA id u13sm18812634pfa.169.2019.03.18.19.26.15 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Mar 2019 19:26:15 -0700 (PDT) Date: Tue, 19 Mar 2019 08:00:51 +0530 From: Souptick Joarder To: akpm@linux-foundation.org, willy@infradead.org, mhocko@suse.com, boris.ostrovsky@oracle.com, jgross@suse.com, linux@armlinux.org.uk, robin.murphy@arm.com Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Subject: [Xen-devel] [RESEND PATCH v4 9/9] xen/privcmd-buf.c: Convert to use vm_map_pages_zero() X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Convert to use vm_map_pages_zero() to map range of kernel memory to user vma. This driver has ignored vm_pgoff. We could later "fix" these drivers to behave according to the normal vm_pgoff offsetting simply by removing the _zero suffix on the function name and if that causes regressions, it gives us an easy way to revert. Signed-off-by: Souptick Joarder Reviewed-by: Boris Ostrovsky --- drivers/xen/privcmd-buf.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/xen/privcmd-buf.c b/drivers/xen/privcmd-buf.c index de01a6d..d02dc43 100644 --- a/drivers/xen/privcmd-buf.c +++ b/drivers/xen/privcmd-buf.c @@ -166,12 +166,8 @@ static int privcmd_buf_mmap(struct file *file, struct vm_area_struct *vma) if (vma_priv->n_pages != count) ret = -ENOMEM; else - for (i = 0; i < vma_priv->n_pages; i++) { - ret = vm_insert_page(vma, vma->vm_start + i * PAGE_SIZE, - vma_priv->pages[i]); - if (ret) - break; - } + ret = vm_map_pages_zero(vma, vma_priv->pages, + vma_priv->n_pages); if (ret) privcmd_buf_vmapriv_free(vma_priv);