Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp962334img; Mon, 18 Mar 2019 19:29:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqzgE1hiBMgN4eV0YxcnZCVfTSDMDrRojDH++C4mCJfTgdlILL4BjIcUDRJbIK+oIigPLMRw X-Received: by 2002:a17:902:5ac9:: with SMTP id g9mr23336827plm.205.1552962543821; Mon, 18 Mar 2019 19:29:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552962543; cv=none; d=google.com; s=arc-20160816; b=HG3QsO8FcCcH+WGBizYqtgOMc5BEtTKHgCSkvsvLgx8ZSvDz4G3YJKn6q2KD15Je6i 1UQv5T4vMPuI5ByvGsAb6Rbr48XHfff63W8ddNn/pRmGomyHLohJclZ0opoAqa8qV6x2 d+6Bo+tts8d7vXXH0eukYZtPtrlCX7fpR2K0OaXqFiap+wusArcoG4MtLrhSmWX6zS5a OyDkI1npMpGqRl2djJS8QvcFTKss1wO96lfbazGqIC7wgZbQyb3NSvcVmeS/dsGitNYi pRDCP8wQYUGzT9blnxl1LYk37t63LPmqJ5NRi0rr1Ob2a2l7owJS8rrytZD8d92rocVV CoDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=F9hIq6OqtC1SVS2O3U7ZkPoLnNclA70DsapCWy7Q+lE=; b=vPDa4Gfad8GYXeaL77o0Wb0sPjjkZCounzF19O+4h9thRDunJyBCz3c5dK26mPaBIs tAU1rD34pxjX0bCRO+JcwWyBbvnUzKbPzZ2EId9UkqWKXwlTlc/NUacF8xCaUtIhSQLC 3HT7fIsNrEYpTvArio+v7ZCB8mdYELbmMIFWuWHTJkoRlZdyQDpnaGabFQtLH73GAarJ c3OEBZvWACt20qE8LQ1VkrJgLHjgEaNiN8lk04GyLC5MYfS3vfSUs5vKpqoEZwPh6Xki k3EW0VwsCdBEniJ03jQkMdJwbw5a/CaDrmt0mrF1VV1nO/5Q90TxsgmvU2jcYR8MRnrD JDEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=axQ01i8I; 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 e5si10547380pgk.150.2019.03.18.19.28.48; Mon, 18 Mar 2019 19:29:03 -0700 (PDT) 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=axQ01i8I; 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 S1727664AbfCSC0R (ORCPT + 99 others); Mon, 18 Mar 2019 22:26:17 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:44624 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726884AbfCSC0R (ORCPT ); Mon, 18 Mar 2019 22:26:17 -0400 Received: by mail-pf1-f196.google.com with SMTP id a3so12592386pff.11 for ; Mon, 18 Mar 2019 19:26:16 -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=B87s+VofwPsS2gNXyBRTVZIUtrvz3xiCFrCNJWM410cenHMmFuxTUCafea3Rsx88Yy NE3f/ntYlgoGB5GoLfo8U59/gw59755t0lFlIgxahfO42V4qMs0Ytga6bgjlm4dHPaRy 0psPvuTNwXS7jYdRR1DbbA9j0BeOBmid/JCNVT7daX+Vq6pF1C+BKG58HBGcGU9l5/Qf SHkYSHwk4Ui8va+kiFTRIbPYfQtjd7GPN+dVwJyVXYVIoFqafB1SoZywaWybm59TpWyF ALETC0pIUMa2Rqc5td1JeVZjueHQO6LWD6U2cmQ7HDqBgvmefLWLUd7fNnWkUaIAte4t oGmQ== X-Gm-Message-State: APjAAAVbMLYZpDC1M3BKyG8oV0Ck8nd5046cPzLzGSqinnjdbZMUJtFV 3OfkyGf7TGYgc4hU5YKk+8c= 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 Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RESEND PATCH v4 9/9] xen/privcmd-buf.c: Convert to use vm_map_pages_zero() Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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