From patchwork Sun Dec 2 06:28:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souptick Joarder X-Patchwork-Id: 10707873 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 130721057 for ; Sun, 2 Dec 2018 06:24:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 033682AE91 for ; Sun, 2 Dec 2018 06:24:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB7622B1F3; Sun, 2 Dec 2018 06:24:35 +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 7AEA32AE91 for ; Sun, 2 Dec 2018 06:24:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BE4406B6200; Sun, 2 Dec 2018 01:24:34 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id B93E76B6202; Sun, 2 Dec 2018 01:24:34 -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 AAD4F6B6203; Sun, 2 Dec 2018 01:24:34 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by kanga.kvack.org (Postfix) with ESMTP id 6D2856B6200 for ; Sun, 2 Dec 2018 01:24:34 -0500 (EST) Received: by mail-pf1-f200.google.com with SMTP id b17so8282528pfc.11 for ; Sat, 01 Dec 2018 22:24:34 -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=pL5Vic5QEKDvdzHBDRgt5oERyEraw2pskBKNWOZBZq5oUgEQAzb2FxUOAv7YJDL6P/ LuraDCPb7QP0NftaeaI/GreVX7cBXTJKN35blKRDewDmPnY/eodeXUiNsCdP/7N9gB2h 1dio+ZNCMJwACc/HHgomWLOg7PP5Bo+Cg4gQLQs6Olbaepo0DmS6uhxpHGXrEotEhpFs Myw2Z34E3BBE7u5iZYQNB1UktAAw67M2TWeaWwRizPL9K+yW/Xp9Uc2pdNdrnTUltGTT P21vTbIrsfqeYrVpUpgMc6Ov4+h/OVwlT2KJn098Q8RaWO5MQYEmuLnHmLW0pQrtkBV2 BXVQ== X-Gm-Message-State: AA+aEWb2Rsr4kxKfXGSk0Sr86HMrdD9UaPsRuvPwIVp+TKarYhiPpaaU eehXATKryDRVZZ5uRABRAIh8e/STBGr8kSyW1O4os/GRD1MFTso3TQL0TYJutOWta/ZlkUCmObW MEBj0K3iXpMkFqDw7JPJQ9rvhWEBdI8RYlS9jOd7x2NejZtxT4Jy1vV1BhuoBzhNwTkNm0UEVXO WGBAMOEDRz2cw8V2MbArsd0odA7VxFBRvbY6WVd+XAtQdc++zOEw1sp1Yi0hCNmbnLqHQyhkKCf bPmdnBJqiweeSQxrXpJACatiIDhP1RAX5N1hmWPN0dfU9WY9oI+FZleUMrRridvp8Bi8ki0UNL7 FjH9NnWf9AltVv0sGK6BUigQrRspW/ddgygWcsOMbsGhQA2Kd09Od3faJpjNb5I70xQKhMcF8zW + X-Received: by 2002:a17:902:27e6:: with SMTP id i35mr11279390plg.222.1543731874127; Sat, 01 Dec 2018 22:24:34 -0800 (PST) X-Received: by 2002:a17:902:27e6:: with SMTP id i35mr11279376plg.222.1543731873522; Sat, 01 Dec 2018 22:24:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543731873; cv=none; d=google.com; s=arc-20160816; b=Jf8o25L1QIRfr/zJCI+AI6ZIA2g+6NQDsju8sLzGP/aG8Jap7/rmdwUqD7Cwfgumob Sr+VUHZO8U5M0Z4SdwGikTOwTcxKw7cTTmwQvGgfGTypjGMfV4wV+ezo4Z5LC29fxw3/ 4bXIfY+0nAb0gJU3j1SF3luZ5t08rstdImuw57y0jRokRaSPhtveLzK5zbMNZNogJgzN +s6cAFvTvU4gRbLWhgpYq1fNzKB1bBCo5hxpYRBCRf/+xJ/XerMiwtDZbYnT4FTy+GHi vfa6EHZiVIdQtxTReymroy81r8oUOgs+iVCgECoSjyAm2AwtSnKSaKvgi+I6g7mm1u6k SmQQ== 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=oMDeKysXtadO7sl/pwWe4IfvNfUzX0MYZBtXGEYIsLcQAtZ5aqLRIHHbQPPE6UQm4w pcs9H5oEZc9lFVF/NdKNyr4msJmQFecafu6ayVysfjmM9P8IV/cD9AukmTDq+W4eiTcr iAsNRWFrFBstI9XxZDr+kUOm0uj+Gux2YgBqIEq2lsuzr02oTm5Hf3PdQP5UL4GALiTy HqrTtg5HtfIwwVKsD9UpJ0x5mj2c91ZEclSECfnfJLZXUHk2KOOFhAs+Vinpjgz/agx9 L3WKj0oFWoOXL2EQES3Qh4WW7b3m9u5cRhKBd6J7mF19PUK80WwidYF8kDqExhXXtx8q 6Wvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NhXPEcwi; 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 l30sor249264plg.17.2018.12.01.22.24.33 for (Google Transport Security); Sat, 01 Dec 2018 22:24:33 -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=NhXPEcwi; 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=NhXPEcwiMw1Jo0Yi0g97yLtSrgjmPBYmW2vb685ioI+U4hCQGjrF1FY5BLpoyPhG2J aUK/Za6Fh/zreav+EGci9N6H6yIIMZ+efw1GT2E+D78DGnWX1JQwYy2ispB3kuDU0tG+ xUzPWz/+xnR6UuC8tUJ+XwhbHAGxt1er8Vj3nl/GgaDT6CNHr9/7ahNkvNZUK/S5Gq1L gr5iVu096dfzeK99TmuYocmpCw8kcKaSuWkguFSJWw2FXhFO5TH9Vkdezq6zXr7JtEIJ lF25ikfMrQW4LCt7tuE7lPEyYftBR/y143U7oi/ufYCkU4nNecNMZWxk13mIn3EdR/VS Lafw== X-Google-Smtp-Source: AFSGD/VHmonIx00YX3S79mkkjHjj09llEDbImZVH68eWMhHUiHmKjvuUEmzCzMegTtM0KXbGzxmF+w== X-Received: by 2002:a17:902:4c85:: with SMTP id b5mr10986893ple.226.1543731872839; Sat, 01 Dec 2018 22:24:32 -0800 (PST) Received: from jordon-HP-15-Notebook-PC ([103.227.99.148]) by smtp.gmail.com with ESMTPSA id r83sm18648620pfc.115.2018.12.01.22.24.31 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 01 Dec 2018 22:24:32 -0800 (PST) Date: Sun, 2 Dec 2018 11:58:17 +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 v2 9/9] xen/privcmd-buf.c: Convert to use vm_insert_range Message-ID: <20181202062816.GA3256@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);