From: Keir Fraser Subject: Re: out of bounds handling for get_mfn_from_gpfn() Date: Wed, 26 Apr 2006 16:08:48 +0100 Message-ID: <3cb5b1ef0c1ad586d1b906d06910e295@cl.cam.ac.uk> References: <444F7D2C.76E4.0078.0@novell.com> <444F8FFE.76E4.0078.0@novell.com> <444F9FAC.76E4.0078.0@novell.com> Mime-Version: 1.0 (Apple Message framework v623) Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <444F9FAC.76E4.0078.0@novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Jan Beulich Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On 26 Apr 2006, at 15:28, Jan Beulich wrote: >> Okay, maybe we need to be more restrictive: 20 bits for 32b (4GB), 22 >> bits for 32b-pae (16GB), and some suitable large value for 64b (31 >> would be fine, it's good for up to 8TB). > > Then perhaps the way to go would be to really check against > ((RO_MPT_VIRT_END - RO_MPT_VIRT_START) / > sizeof(*phys_to_machine_mapping)). > This wouldn't be 31 bits for x86-64, but it seems to me that allowing > 35-bit gpfn-s > wouldn't be that bad an idea (and the fact that the array currently > may only get > populated up to 31-bit gpfn-s wouldn't seem to cause any problems). > I'll prepare a > patch... Okay, that's a reasonable way to go. Please define a macro to hide the RO_MPT arithmetic though. Maybe NR_PHYSMACHINE_TABLE_ENTRIES or something like that... -- Keir