Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp214993imj; Wed, 13 Feb 2019 07:11:37 -0800 (PST) X-Google-Smtp-Source: AHgI3IYI+RvxazYiEsJne22uaXGKICh16p6WggFwk4+IG7tBLrzPRbIZTXcgKlAFa/AU2h7//Gdt X-Received: by 2002:a62:62c5:: with SMTP id w188mr989149pfb.160.1550070697844; Wed, 13 Feb 2019 07:11:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550070697; cv=none; d=google.com; s=arc-20160816; b=CiPlS8pNosRbYwyzs1L3HM4xMpE6H2DhcGK7vDFkgnBT6kSH3cLg+4o9v1XqCyVL7F iqkq0wIsk7ubNLmlgZaJwSVktgHlZPQJMSDz3U8hmQ+IK/6yXeQV77hwaVhS3hXBRvKw 6QJ13MIT/Bg33oKUWcNKIWO9uFt6QH2EHUglnPFCz8aD4OBprZtV/hpR9LMA1j0dZKvz uKJxycwfphKfQH2zQSJ04wWz11dtSKFbedfLhWAI2LDcXN9sojk19yWGFov09wFRQeop /9z+LPv8MlG8O5dSQ5oSh/VHQ4sJ3MpDfhRJHIycxsyTM3u5OP9AlPM5qcC8xsVG+vSX ioUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=F9hIq6OqtC1SVS2O3U7ZkPoLnNclA70DsapCWy7Q+lE=; b=eip2lEeJQHWUz9i3mEjAWWqIPWeWoC7N2alXB6NB5OPIRZUudqNGXBAeszCQ04nSL4 2t47tM+uJsUjKQ9fUpozeOBFhX0azRNpaT0MCgQwy1LMZcZXJj+1IoX5TANHy+abTpaK F09QkBTLTu8Tv7rII7iXKoaLYdLI1ZUEpcWKFj+t/zXCCLI6PXMCihVB4EpSbJB11bts soqfzj2dJ5vdXQHtj/iAne2XU8A1bmhf7rdcS1/l4laMvx3mPBRGZfcYoDtmmylRs8bk C+uMbmC6P9MMWYj+2S45M2A9IfsUdDa91NNHgCQIrGcDgNFFCN2Jrt4tRZ3OVla/KHLt U6tQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mR1zb3ZE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 127si15908459pfg.173.2019.02.13.07.11.20; Wed, 13 Feb 2019 07:11:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mR1zb3ZE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391529AbfBMODv (ORCPT + 99 others); Wed, 13 Feb 2019 09:03:51 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:38737 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726372AbfBMODu (ORCPT ); Wed, 13 Feb 2019 09:03:50 -0500 Received: by mail-pf1-f194.google.com with SMTP id q1so1185165pfi.5 for ; Wed, 13 Feb 2019 06:03:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=F9hIq6OqtC1SVS2O3U7ZkPoLnNclA70DsapCWy7Q+lE=; b=mR1zb3ZEg02mBIPkYaAVMZE66k5L2R/4wFfthpIKD2x3RXESd7eiszAW4r1knRLpTn wnxSzM8wZc5Mkz3Z49kMS93pCVbrKDkebiXliRr0MLguCoBBzx3UIY6gRbVSevX8sUlA t0TnCvA4KzIxDQ1NhguOdXUGK6CEp2PM35M5kw6L8CUGCQorsyg8koIIUymChKedDxwo wDUw7vvME3QeIWVpILxu3BZjyCiOfgTp+xlM8wcQWb2ioU0gaK0lIdJ+zNZxg+bA9B1c 6HYiTaKbvgyyQHIL08zPUp5Nm4UWICDz8npUj7KAUtwMGujiFlESyiR4EEVtAG0NSBzJ vYBw== 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:mime-version :content-disposition:user-agent; bh=F9hIq6OqtC1SVS2O3U7ZkPoLnNclA70DsapCWy7Q+lE=; b=FhgOO1I4l3pFpFmnC538+7lt4x7BJCQTjlmI8hX/uKmx47FGIVY8dY1DORbI33NwSB zHksAHTvi/nx6QdRGiVTlV672+wxmg6XdIKbc8ZtEMyELmCeqYLsqVDkJkkUKibNDmlO ZTsBYrSU8TWtolZ6aq9/KUJgHdvMcZ6y9NBzQdGfn+W4HX13PpzaZvk8tMigEJ1UCzGi 4aF84jedJyKcvpZXOKyGSdt59vYLvVC1k/8qi9NFfW3Q50RFGCoy43ic/wkIXYVj+gcn e0WIJ7tUVA3LzAWe1m/VeL2q9DrThvXGVhX6342b0MTBtodbDJwLFRn1TXlS87CY1rA5 Rndg== X-Gm-Message-State: AHQUAube2wiarC5BvRjAqED4SNPvVOF9fC1yjJm0HNet1ULch6ut/6ZG OZDVLnX0ZyfOhQN8GQEbiM4= X-Received: by 2002:a63:d444:: with SMTP id i4mr600550pgj.237.1550066630319; Wed, 13 Feb 2019 06:03:50 -0800 (PST) Received: from jordon-HP-15-Notebook-PC ([49.207.48.54]) by smtp.gmail.com with ESMTPSA id e2sm36513942pga.92.2019.02.13.06.03.48 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 13 Feb 2019 06:03:49 -0800 (PST) Date: Wed, 13 Feb 2019 19:38:07 +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 Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v3 9/9] xen/privcmd-buf.c: Convert to use vm_map_pages_zero() Message-ID: <20190213140807.GA22098@jordon-HP-15-Notebook-PC> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); -- 1.9.1