From patchwork Mon Dec 17 20:26:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souptick Joarder X-Patchwork-Id: 10734279 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 5EF2F14DE for ; Mon, 17 Dec 2018 20:22:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5193F2A2DB for ; Mon, 17 Dec 2018 20:22:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 45A962A2E3; Mon, 17 Dec 2018 20:22:56 +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=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE52C2A2DB for ; Mon, 17 Dec 2018 20:22:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D6F358E0055; Mon, 17 Dec 2018 15:22:54 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D44CC8E0033; Mon, 17 Dec 2018 15:22:54 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C0D418E0055; Mon, 17 Dec 2018 15:22:54 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by kanga.kvack.org (Postfix) with ESMTP id 7A96E8E0033 for ; Mon, 17 Dec 2018 15:22:54 -0500 (EST) Received: by mail-pg1-f200.google.com with SMTP id o17so11580874pgi.14 for ; Mon, 17 Dec 2018 12:22:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:date:from:to:cc:subject :message-id:mime-version:content-disposition:user-agent; bh=5oYSW/GvpO5Jr2lAVUEKxgPmdiaC90t9yQ4KohCOQbY=; b=l8k6dXf4uZsgSCCntbLmqeN+s8+IXKrZ/Af/SmyYfU8Fo0k5qc4B+gXc82J5/JrnLs GEPmIn3elq2R7aEr8Bt+dntO8JqG+A/tmGwN63lzdTNemaUcaZuGqm66+zVFg9ydI3wW 0562XS0b10uHTo0x4pSSwwNTatHqgVPHusifgFYfd7VNRigRSqZGYK73wfzclpsed2gp 229zuJ6hM7EB9F4/KQ/+E56+6OBQRtuHjWBmkiNRpFXLA6xWKLH70jnlFUtcgVWhsBUz nj2sN6v+nQYS4XQd+v7vHgPeCWD6vvWyRnJNv6Q093G6Q08VvV5xL98RFDBA7qZJ19Hx YX+w== X-Gm-Message-State: AA+aEWa2Deje5k9rlQuWA28Z/Zf9CtXXUgjEc2T2zdRV21wLrBwpN0DM jUu2orMe0QUSV1k3MwSCQq2AIcAvugkp4a4S76wp0Cjl9/UGOf5CR1rpFbxg+ec+VK3Pmgq11KB jx1iWI8XKg8mB8GBqDQrGU2LwVMqArrODUxxrvkaBmLcu8VBxrV3IzWtf78zmY+Mm5Vt6uNXcHL EfBBylJziXvUBwRAWtVpwuiZ8M/0Pygc1US4KDjk4X0niLxiMHOyOOaS+c280yDFrak4zD3krAG v1vnvR+aJQEKwgkHtr8+x1As18rQ1b578kpBcRr0AHvIEF9ZZAcZMkZ0OqIdnrKoe8eomb6jM0B 2BGYrmNO3JFlR/IXCsqjm1Gfl42Kbc76sH9c9cSOqEVJ8kdppRdy9E2H8D5BKGObV3FZ0UARKfo f X-Received: by 2002:a62:8096:: with SMTP id j144mr14316684pfd.140.1545078174186; Mon, 17 Dec 2018 12:22:54 -0800 (PST) X-Received: by 2002:a62:8096:: with SMTP id j144mr14316655pfd.140.1545078173617; Mon, 17 Dec 2018 12:22:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545078173; cv=none; d=google.com; s=arc-20160816; b=tS6qdCe43saa7s+18dX6GqV3HiThj3dkcmWGWBxI2i/uA6oV+cPRRWXhlPtLJoFdPd TFHrio3xGr65xE0IvXcM6EMzMeXZNo3PkqtZkfxUsq95FAOhet9muDVpyRURTAkW7bJo tyKQboQmmjZ7c0xk+nVcP0WZNNCebJbrJGWrPyYxJEUvuv/77H+WeKisQYs1xG5vlqOf VmquOZz+cYI3VMT4SdwZONFVZeaM5z6SwS0H/B2Br4fX6Ney1NLvP/GnTgOR4ELBip2d yMr5OV6ELl9GEIxFX1nGS4T21W2Emoof25G8oYqW7HvAc2hXTaSDbCieAgRlxp6Uk98S ebOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:content-disposition:mime-version:message-id:subject:cc :to:from:date:dkim-signature; bh=5oYSW/GvpO5Jr2lAVUEKxgPmdiaC90t9yQ4KohCOQbY=; b=yfh0IzIQ4o8rKS1Ek3dk9e/uFdiYeVobthjWSpFQSlY/j0OAmk1K1zAO8Ys10hCCPg 2wtUcvXDCakb6dwNHdUMezBVJ0Ovm30oDxGP+XT3F7RpxAAIWIxseidD6B4CSgTFLneU lT/ui2SShfXUx6Hcdtauas4G8/bgoHFkvxiiWDEJCHhuCvJgGUlRrwR5NASHoCbkNXv6 HloDHAn7aX0KNXwoNh05kAy1Z16tjpOl9a5WB74AknCh5HPP+9mzYxH3FxkWwmchihB2 w9mb/ymI8Dcw7yCF6arAX/jRqRZlM5M9CW3GtwE7OQBGu3+yG6PCkp2mBpIadxA0it0H 7ehQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uUpc9hwq; spf=pass (google.com: domain of jrdr.linux@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jrdr.linux@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id t62sor22947298pfa.72.2018.12.17.12.22.53 for (Google Transport Security); Mon, 17 Dec 2018 12:22:53 -0800 (PST) Received-SPF: pass (google.com: domain of jrdr.linux@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uUpc9hwq; spf=pass (google.com: domain of jrdr.linux@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jrdr.linux@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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=uUpc9hwqBACC1ZZmRW2aJsERMSJYQSVWUZFU0pgyeaJfu045oCUzYU8kMbaQ6ZcswG cFnF7lbG8tboEYSgWHBixo5XTCn6nKmuO3d8msyYCleyVTR2qX22tayUeQ1wmuMoVRwJ VrbmiaIaYzoTlf4ZGENyW19EFsqEHXYXe9bvt3o4HL03lfBc/25uinXGuzEpMxuGiNNb vP/QGj4O7JdWYnb4pQ4Sp++kzTjEym3CCaLCMzy2ECrFxoW1FDGtTK/6IYn2AuBSNMJr bJ9VX56znbPJzTEv4tUW1S/bmY7fT2QSIaDklkp7DHN7svgrhsUTgRGVzN5ZtM0wLrV0 GX7g== X-Google-Smtp-Source: AFSGD/UQwbbHHDgaOIDkqKpoGY4JfB62/5kRzA0kZTM7mwQtu/OWvxDxGYC44oQHanjoZ9eudkvANg== X-Received: by 2002:a62:5f07:: with SMTP id t7mr6183800pfb.108.1545078172823; Mon, 17 Dec 2018 12:22:52 -0800 (PST) Received: from jordon-HP-15-Notebook-PC ([103.227.98.208]) by smtp.gmail.com with ESMTPSA id b68sm21581385pfg.160.2018.12.17.12.22.51 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Dec 2018 12:22:51 -0800 (PST) Date: Tue, 18 Dec 2018 01:56:44 +0530 From: Souptick Joarder To: akpm@linux-foundation.org, willy@infradead.org, mhocko@suse.com, boris.ostrovsky@oracle.com, jgross@suse.com Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v4 9/9] xen/privcmd-buf.c: Convert to use vm_insert_range Message-ID: <20181217202644.GA19376@jordon-HP-15-Notebook-PC> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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);