Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp809911imu; Fri, 7 Dec 2018 09:13:23 -0800 (PST) X-Google-Smtp-Source: AFSGD/UdWxZ6lrN4BNXVJ+phkcQZf0LXKfKw+FJSE4tfaDzart+zDnXNacvtuNKpJElflrIpugIh X-Received: by 2002:a17:902:50e3:: with SMTP id c32mr2930270plj.318.1544202803331; Fri, 07 Dec 2018 09:13:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544202803; cv=none; d=google.com; s=arc-20160816; b=z/iPqEDkTTp9X113u/bPh4VFKeYXV70BrH0ZHVJvqAcy0qKj6hMD3CDER8DVjibJdx GEQVaKoZwLURvKEa+rsZ7V6xrnrM4/2EhrV7pYclj1gSQTq9wFAY3H6fXH3jTU9VWYMA tNhHqYr/ftQzQ88pcEz6NtnK9rQbRdVRLdmQFrrvSfn5iEyRZw0NXVAFNfVZiEckwHG3 oXhqFEC0+S2XozENLoksZdL0pP8pkgsfE8Ww8as3orvOq3Wktj8xBH8q0yYTt6OEGXJr iJUZ6wlGcW9oxa2kJyjP8f4y5R1jRdpmmsmAaZVLeSnMncRMkdpWZy0MDy8rxzD4XQgq QC7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=cveUhY21evAj175EbvLIvaHXmqv3QWYBYVfgJxSvrwM=; b=xFz3YymXqVV/2jrv8dVho8TpQSEjlQoI6QI53MsmHO71b3vN6uowuMLazxb2o13BVB cqCgIo6pR2TJ6nIo3Gx44PqjPuHpQyc/7Ba6F46SDSS29ztQsU+ALtGDhlsMIwmDEYRx wgh0u2IwE9NgcL5ejUomh3WBUUQg/kS/4szIZbxNqg2BQCHCCYKPaZ16oVBblXr66snu 3f6ztvtxg4ye2BYusQQ5gbw00DV+uuEpL0wZ4wkQ8w/7GtUKS7pMeeWK2nIkKZHJVqUa HB88N1kNXThQz8I4JTdK155p1DjiIQ8Ikzu0/nCtnTcINXZGiVkSVzsk63RID1anr/KM BiZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=V89YIUIX; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o3si3229289pll.201.2018.12.07.09.13.06; Fri, 07 Dec 2018 09:13:23 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=V89YIUIX; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726086AbeLGRMO (ORCPT + 99 others); Fri, 7 Dec 2018 12:12:14 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:59814 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726027AbeLGRMO (ORCPT ); Fri, 7 Dec 2018 12:12:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=cveUhY21evAj175EbvLIvaHXmqv3QWYBYVfgJxSvrwM=; b=V89YIUIXoO+LmjEyY/Dz/wS1N H+CSHA89DnsXDIXYQt2ksXbQc2t3E1OCaQ85e8K8FzaXOp24BfiiRoepc2mb9096CNEbx/V4hNZov gMLRkf4dxxbin+x2tI5uE/Dgz8aGXb1nyknlhLkqXuRmS3rzc9xkNJ+V+aSrBJTpbecBvHpri/hIM iGAoscHggz+LLXzdpFkE0tdus0JegCSP6HZk1UPnTyQ6WRBIuqskwVeZdpwsgVKiXvJ1eZNgAtsMP Niu+/Epu5YQ1aovsQCSdvsSn223GFp5ARi6iZOxkT1K8i9Ui3tH2D4Ma4IJpRrNM+0KuVhKCH5PAO xa0DKCP2A==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1gVJem-0000g7-K8; Fri, 07 Dec 2018 17:11:16 +0000 Date: Fri, 7 Dec 2018 09:11:16 -0800 From: Matthew Wilcox To: Robin Murphy Cc: Souptick Joarder , akpm@linux-foundation.org, mhocko@suse.com, kirill.shutemov@linux.intel.com, vbabka@suse.cz, riel@surriel.com, sfr@canb.auug.org.au, rppt@linux.vnet.ibm.com, peterz@infradead.org, linux@armlinux.org.uk, iamjoonsoo.kim@lge.com, treding@nvidia.com, keescook@chromium.org, m.szyprowski@samsung.com, stefanr@s5r6.in-berlin.de, hjc@rock-chips.com, heiko@sntech.de, airlied@linux.ie, oleksandr_andrushchenko@epam.com, joro@8bytes.org, pawel@osciak.com, kyungmin.park@samsung.com, mchehab@kernel.org, boris.ostrovsky@oracle.com, jgross@suse.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux1394-devel@lists.sourceforge.net, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, xen-devel@lists.xen.org, iommu@lists.linux-foundation.org, linux-media@vger.kernel.org Subject: Re: [PATCH v3 1/9] mm: Introduce new vm_insert_range API Message-ID: <20181207171116.GA29923@bombadil.infradead.org> References: <20181206183945.GA20932@jordon-HP-15-Notebook-PC> <53bbc095-c9f5-5d6a-6e50-6e060d17eb68@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <53bbc095-c9f5-5d6a-6e50-6e060d17eb68@arm.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 07, 2018 at 03:34:56PM +0000, Robin Murphy wrote: > > +int vm_insert_range(struct vm_area_struct *vma, unsigned long addr, > > + struct page **pages, unsigned long page_count) > > +{ > > + unsigned long uaddr = addr; > > + int ret = 0, i; > > Some of the sites being replaced were effectively ensuring that vma and > pages were mutually compatible as an initial condition - would it be worth > adding something here for robustness, e.g.: > > + if (page_count != vma_pages(vma)) > + return -ENXIO; I think we want to allow this to be used to populate part of a VMA. So perhaps: if (page_count > vma_pages(vma)) return -ENXIO;