Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3609811imu; Mon, 24 Dec 2018 05:27:19 -0800 (PST) X-Google-Smtp-Source: ALg8bN6SSqesnJy2w/uE0uXgWvA3+6I5hBtFPJ/3z8ocOqWvblTTwiG1X/91r0zdT45VQ2j8gNsx X-Received: by 2002:a63:d252:: with SMTP id t18mr12452994pgi.133.1545658039192; Mon, 24 Dec 2018 05:27:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545658039; cv=none; d=google.com; s=arc-20160816; b=bDiQtPxMghIXnmT0TAyKmHpwqbwhEp3anFBMlsh0wy1ihgpBDkrKimUSq5aLpUeGTi YZbv/9pnoBSUzaM2U7eiUoyenL7Rk3zcxhYDzsZKNTxDdxPsPCjFEQUYaixyoF2AElRd dGyK9i3uVTGdUp/cOH8A95KJvDwXrQVR1TXCYOdS4jErlpy354ZHpoYRea4lee6cr+Uv 3ZAtysrimWpSAmv/jvYTmYLt0vsiMvjB4mctlR1RjATsj+El67a918OLVaGHkX7VBd96 UQiM+wgMu0deKEr2UcU7uFqT8rBYEQixU3FrW+gEO2JFks5yxGwzjGT3bsi+wKuteT6g 7OgA== 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=5oYSW/GvpO5Jr2lAVUEKxgPmdiaC90t9yQ4KohCOQbY=; b=03A2DtVx09kEAVMEU4AVzDIBYsV4qDsnG/XbpvT9+b1c57ebSJsDF4kLJD2MQMIRoQ hNXaTUoftOudF/FzJ2ceclnoEVq/x87LRgjVpUEPC+zHqJEqtRZ8X5mrlhGLl7pJ1Gfj 10ZKMo+gmqejrz8rnw5eqRdgSgrfoXPurz/m+G3tmhs0Ig/MfeornTmDOSuCJz+0271A dRAZ5SQUFvcCzq1eoNe673JWzuzpdnPIOCpa5lbXHlQoLTK8La6VMaJsdBN+clpZWsvz 3WVCAgOAAGD+YB/V4V/1np9fvWYDAwO9cj97VfP8xQoJ9BNGCLrJ3313QzO/syEZtVlz 5jVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="GDuxmq/A"; 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 r12si26965647pgl.350.2018.12.24.05.27.03; Mon, 24 Dec 2018 05:27:19 -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="GDuxmq/A"; 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 S1726434AbeLXNYk (ORCPT + 99 others); Mon, 24 Dec 2018 08:24:40 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:45347 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725446AbeLXNYi (ORCPT ); Mon, 24 Dec 2018 08:24:38 -0500 Received: by mail-pg1-f194.google.com with SMTP id y4so5587967pgc.12 for ; Mon, 24 Dec 2018 05:24:38 -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=5oYSW/GvpO5Jr2lAVUEKxgPmdiaC90t9yQ4KohCOQbY=; b=GDuxmq/Aic15WMXOQMH4HrSFG0stmPhzQGi79maKq+afi8zw5IjbX4WO7EBtU4Y4Aa es7qIcOpTYJ4MljVBfAKdeTApaICyrUwH9OHwTSRD29kMCYJUvUrqfFRTtWBCFSDVNaB D+08WqR+rmVKV+OBhkdgasAMMBrRM3dftytU94MpNoljNyFWIQC5SLE3qv2rEmBJP1iY PlWL494kqT4wHJc9k0khQ6jPK4JiFTqKXalJHhj9TcvGX63+U/1VnAEr5HTgPK+1/Old 8ZWRZQjCT44ajiLNhJX8FmB02uUMM09edQpVw7rX6LARSq6srEeuDlG8Z8hUmpKJre3P rPuA== 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=5oYSW/GvpO5Jr2lAVUEKxgPmdiaC90t9yQ4KohCOQbY=; b=X4OCCOWQjRygZKF3st/eRU9KnaKNsG50p+H5e5bYMnZ5uDIgcL4oLt5CbMviB4AIVo x5U47hXncct6WafHTgZcRP+oX/CXnTRdrNDz0F2ZG+RQBC2gesjo0gM1b8aEq00byB6E 7qY/raao7on2KjEA9zEbRbEm6vzEJ848DbOL7BA+wjomgqzk/94yJlcaHMG4p1SmbGos xP3TAgWW8kolAD1mGM5r+JKQSJ36BudboHrRuPySzW7n9atLW57IxNzdSgg9ofOQDQZo HB+g3NqF0FkvWKhrCA7jKAaum5aJc87zaTTNSSIP0lkO9mP/xOyg9nSDv97B6/wJCSDL 0EAQ== X-Gm-Message-State: AA+aEWZY8/q8gaUplyOD8IrkqvknKYQLW2TUtSBrTmT8knVF3IQkucIT 7f2nbTZsIMscydXR2DKrAUk= X-Received: by 2002:a62:9111:: with SMTP id l17mr13092429pfe.200.1545657878185; Mon, 24 Dec 2018 05:24:38 -0800 (PST) Received: from jordon-HP-15-Notebook-PC ([106.51.18.181]) by smtp.gmail.com with ESMTPSA id v9sm44373114pfe.49.2018.12.24.05.24.36 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Dec 2018 05:24:37 -0800 (PST) Date: Mon, 24 Dec 2018 18:58:34 +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 v5 9/9] xen/privcmd-buf.c: Convert to use vm_insert_range Message-ID: <20181224132834.GA22203@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_insert_range() to map range of kernel memory to user vma. Signed-off-by: Souptick Joarder Reviewed-by: Matthew Wilcox 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 df1ed37..d31b837 100644 --- a/drivers/xen/privcmd-buf.c +++ b/drivers/xen/privcmd-buf.c @@ -180,12 +180,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_insert_range(vma, vma->vm_start, vma_priv->pages, + vma_priv->n_pages); if (ret) privcmd_buf_vmapriv_free(vma_priv); -- 1.9.1