From patchwork Fri Jan 11 15:13:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souptick Joarder X-Patchwork-Id: 10758227 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 B20A391E for ; Fri, 11 Jan 2019 15:09:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D7CA2A0A0 for ; Fri, 11 Jan 2019 15:09:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 919E92A0A4; Fri, 11 Jan 2019 15:09:29 +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 355612A0A0 for ; Fri, 11 Jan 2019 15:09:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2BB348E0002; Fri, 11 Jan 2019 10:09:28 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 2917F8E0001; Fri, 11 Jan 2019 10:09:28 -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 1A8B28E0002; Fri, 11 Jan 2019 10:09:28 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by kanga.kvack.org (Postfix) with ESMTP id CF0098E0001 for ; Fri, 11 Jan 2019 10:09:27 -0500 (EST) Received: by mail-pl1-f200.google.com with SMTP id a9so8423540pla.2 for ; Fri, 11 Jan 2019 07:09:27 -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=HRKqpRHmU+L58qncR6PcEXsm4g4xjV60VkG5Win5xw4=; b=TtQLQvBrKbroOHYAHaJ8FFc/kibvn4PDPAjxqFSXKKSJvJ7CKu1tq3SoNyZR2NRFD0 /xUGGpKp5U1P9fOseZmqZR5Ebbh7T1ndWELv8OL+jaehi9SYfd3SiSqmazOQUANjjclU 8b4qDRs7Ik0J39NG7dW9hAvUcPCJvoew+K3tfWCckY/h7Gu/sMWUA07VDxi3a8jaAZze /oT1I9xBIkK5fPNNpXun+q5RrUlu4hXIeof7cemsEQW9BuyfAJ9qdPswkNcB3dLC1qo/ Fp39nsGLFHBtWIdpm+tLaDM6U6p6KUVcHytdJCZCFeQmerszALjP3tIaJXjfU94rCGda EFlA== X-Gm-Message-State: AJcUukdntId5s2zd1jtLqOElAInDHeRySJiwTycWPNlWlpqghRqvuJvh BOYiawv8NZTUDUjOvvZVE3Ng9jB/nzKtk0KgG1TcW7EoJOs5Fve5+0pf6As1odhrJw+5OQpfrlH NbrYwoApSkf5wmWvO5QDqlfX2kuVEb+EKFHuK5sTT4srmMhWIyE6SkgRQi/TXl71o4K4usJ5TCq 9/R/uoWZNJPeWoyph25B+WJunate/F9k1/0cvTNHWZZVSIvsRBduWqvqT4gInIPm9PL3PqtPvyK o/UFy7q/M9sPjxs6sDFroHQyaEixcwZR81hreNIa3lEA2yHdA8IfxzKEUEAOhWKsY3Yk7c39Nct LeNePSkXMcOjM/DW4gQNLsqUUZLu+O+JfUHZBHVhExDz8wxPP/ZXRWdLMB2IWGomcUL605ChHpy i X-Received: by 2002:a62:7792:: with SMTP id s140mr14860171pfc.26.1547219367514; Fri, 11 Jan 2019 07:09:27 -0800 (PST) X-Received: by 2002:a62:7792:: with SMTP id s140mr14860118pfc.26.1547219366882; Fri, 11 Jan 2019 07:09:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547219366; cv=none; d=google.com; s=arc-20160816; b=LzJfOUozIo7orku96sSwOntp7a6uLu/XfFi8cCXCulihFdxVO30vboZoZn8p3ik+9M aaUokCg0ClP5zg724yvxki+NIezZP0J052DRTZPdX9dXThOjULHcKzyvo7HTS/SQRdu7 BUf2J/AET5bmSRtUHBWWSyKc4BHqpMwmGGN4jOjmpB8wACaQv0CnvZViNFv8rFzZnXNi 5ftXq/nNFhceYF9rjQhlD2BRnI/l0QPeU13M/Gv1JbASq8p35+q9Ft/SV2Kn6D81xanS xjgA60yDvsP/FoRK65jorqpX9cB1WrHK5Il+bu1BDneNXNzFo9WU4bBm2OYuHZ4Cwa1p GJuQ== 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=HRKqpRHmU+L58qncR6PcEXsm4g4xjV60VkG5Win5xw4=; b=F02oT0GgzMevaIdhPWlzBnkDu9HpmICYwk63gLqHSoHXsG3xXnOXk338/51rPO7OkR JZu6fntEUmm26TX06QsD9IHshQ3X1/0yoNJclpuK98Wef1U6T3V3cd336X7w+cyplSJm OCQFdDm37niB2GhYxKolt0EBzzUEYGAKdwzJDRYn2o2mYbjIhTNuIVtolOA7rrtNMC7g 3xlQIGDg70x3Nclqt31ssVIagrKmj0s53b0p3VawdKrMtnhx8yMMG/V+EJqXK3GS2j5B XiqadHcc0rUVzshUZQrpm9JnNRPhxCiDCPcxXSxMqnoHdWPHT7q8sgtncUgOkd0VsNZx RfNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JuNrLoG8; 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 v15sor3927947pfa.0.2019.01.11.07.09.26 for (Google Transport Security); Fri, 11 Jan 2019 07:09:26 -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=JuNrLoG8; 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=HRKqpRHmU+L58qncR6PcEXsm4g4xjV60VkG5Win5xw4=; b=JuNrLoG8W9qZ3wovEJ6sEuIJ29dYs5vMzRIRLtQz9SUWeNl4UjyyhYVOScTr6JHLn2 Eakll8RWLEKrzrgsL7JiV9od8DeDB/HnCTihU+VsG+6pQMp1IYeFSVAW8ic4nAjGgwPu ZquG80FbhCmfchutBXtjW0YNVRdpaTlpJVOe6VTaq+Nm7rNFETfSlrUrbqVTIG45AjOX YcGlCzK1UZdaie9TaJRXte+oGsy8++6U7VC24my1faXZkU2RJU+HKD6DEDvFlr7rPo5p 9hqCN38u1u8+c4OS7vN1ygZtyNLYx3RnDsPhAlpbGIdc6CloSEBGOHLU1mxZiDsPzv38 ZPgg== X-Google-Smtp-Source: ALg8bN40ZHV+TGI6LLpALtlmSgNcU7DuNE7kQ77YVrf7dr/Bp0HI7ekI92a2R/MlUhJCUqv1tRv+Kw== X-Received: by 2002:a62:8c11:: with SMTP id m17mr14936629pfd.224.1547219366063; Fri, 11 Jan 2019 07:09:26 -0800 (PST) Received: from jordon-HP-15-Notebook-PC ([49.207.52.190]) by smtp.gmail.com with ESMTPSA id j21sm109918120pfn.175.2019.01.11.07.09.23 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 11 Jan 2019 07:09:24 -0800 (PST) Date: Fri, 11 Jan 2019 20:43:26 +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 9/9] xen/privcmd-buf.c: Convert to use vm_insert_range_buggy Message-ID: <20190111151326.GA2853@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_buggy() 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 _buggy 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..a9d7e97 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_insert_range_buggy(vma, vma_priv->pages, + vma_priv->n_pages); if (ret) privcmd_buf_vmapriv_free(vma_priv);