From patchwork Thu Dec 6 18:45:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souptick Joarder X-Patchwork-Id: 10716631 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 826E818B8 for ; Thu, 6 Dec 2018 18:42:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7284A2F15C for ; Thu, 6 Dec 2018 18:42:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 634CB2F17A; Thu, 6 Dec 2018 18:42:02 +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 EFD2B2F15C for ; Thu, 6 Dec 2018 18:42:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 313156B7B61; Thu, 6 Dec 2018 13:42:01 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 2C3376B7B68; Thu, 6 Dec 2018 13:42:01 -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 18C716B7B69; Thu, 6 Dec 2018 13:42:01 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by kanga.kvack.org (Postfix) with ESMTP id C715B6B7B61 for ; Thu, 6 Dec 2018 13:42:00 -0500 (EST) Received: by mail-pf1-f198.google.com with SMTP id i3so1027217pfj.4 for ; Thu, 06 Dec 2018 10:42:00 -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=QkAoEj0L9qsuE5G4ssoKQbBfw8UWUhYAoif7GyqYqTE=; b=T35X4nSjdOX03Zu6fmiki7uKyy1mCVbmJ0ZX7x162GOb7oYuQ4pnG2vkDnVAYiMdlT /RGgqc5+r3N6of3hBkflZwEFawGOeXEC1IRWN+bkZv+tU6SIewC618dPuOASQJkcq7ks jh8Ohkp6Cc827v59EjGzkqcQOor+XL9S6GuFp9H1S4Pm7sFIf6TSHoxd94fIpmbIt/WX Flj4Wm+PCSPtrlpFEIC9PmUfgR5ZF330kxGcgiY6LUfO0tl0dyiGUDlO5+c3qlOCUIYa jvyZGEeU4np87XLL5JTpqtIyTC7RoMS0OMcxaQzpZoYSjrey1dZWKgJivGClfkebUXD7 J+wA== X-Gm-Message-State: AA+aEWb3dS3uFlhCvaf075uim26DcyYld3X44R58epRS02pY10BmaYDT z7oufYMf+wAL25GZFzPXlaQfs9KNBbtdjmRPS76e9OvUAhrDQlUGJGU9IlJA6VhYeBRMAy6yCJo NEMAVJxnKAhBrGNCskmee2zFlddLYi9uslQopRNaIVLANRm2AgB2ujjy/yIv2py08h04XVFWUyQ 3INyW+uytEd3LR6af4euroQsp4CWVYPmXHGNv4EaTMfSlXQ885s263hArMyNZTKIyQmFEfUCON8 MTGKM+BdD0019rsB5PCOBhoyMtO2BikvrsRVjC3pHgRzdcsYS1trgpmiyO4X4PNE8Z2z/OQLkXH tUIGztQNPu1XzByItk+i8Z5HS4xyF3YojmyPud9cAW87FvUl3Lw4k+7HZUM6dDuSRGLDHV/P/cH R X-Received: by 2002:a62:d448:: with SMTP id u8mr21079444pfl.105.1544121720480; Thu, 06 Dec 2018 10:42:00 -0800 (PST) X-Received: by 2002:a62:d448:: with SMTP id u8mr21079424pfl.105.1544121719797; Thu, 06 Dec 2018 10:41:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544121719; cv=none; d=google.com; s=arc-20160816; b=NDTIyxVnkvw7Ie9nwxf7Sc9hfIfzSucn6Mjy5fYhzYoU6mF4Mej/yoqvPmXiOFuDK9 gykm66QR1kbTmE+A4rW8G7HhW/PlIDnmb8QIOONgAZcU/C2t+Hr4cIp7evZ+fPfk5kU/ lofR22LS9CQYWyrFRVljLIomMJfW/pp5QXs9XZBdlulBN5+h0ERQaQZw6LvaldHiYxmd r63rurm33JBZRQYQA6rCUJsmpdFIxm5zHH7XVBljrWVQp2dLkZpnvD0U00pMCM4y7tm8 9l2EpUnzHUeVKYoHaM06YP0I9oWaocrxxkpd4JajU/Q9XvOeLZ4dZm2JhgFkGfd05EQ5 j0QQ== 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=QkAoEj0L9qsuE5G4ssoKQbBfw8UWUhYAoif7GyqYqTE=; b=F7ICcmU2HatxJfs3eVfvxazYOWTfBD4Rq9TNeunEzgCC65nGQyT403MEIoaFjHKc9q 66tU2sOy/JK0doP4z/BjmwsmkrSBkUjgQA+fsFp0IjFjrPWnhjEdjk2pUvp7nwW2pv2Y Bgb/pIZJFo6QIcMxrWCt4UI9nCBHvaElIPcA954KXXC0KHOLex1G/XU/m/ayUcLTwAWa q/IypyI486esllyC/2Y6ttlCTkr/J5i6f54Mh/5JsDe2PlwacWo3oeuAEp1PXot/BQ7/ Gll1iFF6ay/de7auSDUAsFJz6N1Hd7wucZ7cIHWf0geTTO9kEyABCF5oOuCgIAQrUjG4 rMfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gidEjeZS; 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 y17sor1811434pll.68.2018.12.06.10.41.59 for (Google Transport Security); Thu, 06 Dec 2018 10:41:59 -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=gidEjeZS; 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=QkAoEj0L9qsuE5G4ssoKQbBfw8UWUhYAoif7GyqYqTE=; b=gidEjeZSbgItFGgWuJFdFe/ifliMLckszZaKhuDF0zT/ioQ/oR6cL7ETSduh8Iu7Ik nS1fUixG86BlJLDTz1MwqqLTuw9w3Ln38dTpDkXEWmtIOCQex1iam9lHoAbBENd9Bj4N DB4oeLz+ZVvBocvnc+0Iff/c+zSLTVwDJQ7NTOSjuFH1bbVlk82jqaugJMfPoMbGvfTj gqJG68rpZMa6/x5sl++Db1yULJskHuJuSMOhe656RDv6HOhIt5hgIMwL+ZSAQfMvR9U0 U7FElxxBVFgtH/SYb7JK+Qwm/bqeDstaOWXtmI1Rw1ueeRLaDLZBGqHc8VtU4GDS3vRI RSzQ== X-Google-Smtp-Source: AFSGD/WPPXRIO+khmBGTNbV0MDnldPRG23ivTHyBZ4IX8eX79jqs4heYiOhzo6Y54/NC8l3kR3/n+w== X-Received: by 2002:a17:902:1105:: with SMTP id d5mr28133182pla.47.1544121719014; Thu, 06 Dec 2018 10:41:59 -0800 (PST) Received: from jordon-HP-15-Notebook-PC ([103.227.99.39]) by smtp.gmail.com with ESMTPSA id 184sm1407299pfe.106.2018.12.06.10.41.57 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 06 Dec 2018 10:41:58 -0800 (PST) Date: Fri, 7 Dec 2018 00:15:45 +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 v3 9/9] xen/privcmd-buf.c: Convert to use vm_insert_range Message-ID: <20181206184545.GA847@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..8d8255b 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);