From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mukesh Rathor Subject: Re: [PATCH 3/18 V2]: PVH xen: create domctl_memory_mapping() function Date: Fri, 22 Mar 2013 14:02:22 -0700 Message-ID: <20130322140222.502c9f89@mantra.us.oracle.com> References: <20130315172623.76aaa4c0@mantra.us.oracle.com> <20130321150433.GK12338@ocelot.phlegethon.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20130321150433.GK12338@ocelot.phlegethon.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Tim Deegan Cc: "Xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org On Thu, 21 Mar 2013 15:04:33 +0000 Tim Deegan wrote: > At 17:26 -0700 on 15 Mar (1363368383), Mukesh Rathor wrote: > > In this patch, XEN_DOMCTL_memory_mapping code is put into a > > function so it can be shared later for PVH. There is no change in > > it's functionality. > > >limit is an unsigned long, so 'int' doesn't seem right. > > > @@ -628,68 +690,13 @@ long arch_do_domctl( > > unsigned long mfn = domctl->u.memory_mapping.first_mfn; > > unsigned long nr_mfns = domctl->u.memory_mapping.nr_mfns; > > int add = domctl->u.memory_mapping.add_mapping; > > - unsigned long i; > > - > > - ret = -EINVAL; > > - if ( (mfn + nr_mfns - 1) < mfn || /* wrap? */ > > - ((mfn | (mfn + nr_mfns - 1)) >> (paddr_bits - > > PAGE_SHIFT)) || > > - (gfn + nr_mfns - 1) < gfn ) /* wrap? */ > > - break; > > > > ret = -EPERM; > > if ( !IS_PRIV(current->domain) && > > !iomem_access_permitted(current->domain, mfn, mfn + > > nr_mfns - 1) ) break; > > Why is this privilege check not being moved along with the rest of it? > Execially given that the two other IS_PRIV()s below are taken? Because, the other caller is construct_dom0, so not really needed. But I'll move it anyways. thanks, Mukesh