From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH V2] xen: Check if the range is valid in init_domheap_pages Date: Wed, 13 Nov 2013 13:34:08 +0000 Message-ID: <52837FD0.2030303@linaro.org> References: <1384348525-3230-1-git-send-email-julien.grall@linaro.org> <52838BFC0200007800102DBE@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VgaaD-000067-1I for xen-devel@lists.xenproject.org; Wed, 13 Nov 2013 13:34:13 +0000 Received: by mail-ee0-f44.google.com with SMTP id d51so218766eek.17 for ; Wed, 13 Nov 2013 05:34:11 -0800 (PST) In-Reply-To: <52838BFC0200007800102DBE@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: Keir Fraser , ian.campbell@citrix.com, patches@linaro.org, stefano.stabellini@eu.citrix.com, tim@xen.org, xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org On 11/13/2013 01:26 PM, Jan Beulich wrote: >>>> On 13.11.13 at 14:15, Julien Grall wrote: >> On ARM, when an initrd is given to xen by U-boot, it will reserve the memory >> in the device tree. >> In this case, when xen decides to free unused memory, dt_unreserved_regions >> will call init_domheap_pages with the start and the end of range equals. But >> the latter assumes that (start > end), if not Xen will hang because the >> number of pages is equals to (unsigned)-1. > > The change is simple enough, so I don't really mind it going in, but > I wonder ... > >> Signed-off-by: Julien Grall >> CC: Keir Fraser >> CC: Jan Beulich >> >> --- >> Changes in v2: >> - Change commit title >> - Move the check in init_domheap_pages > > ... who and why suggested to move it here. After all, I'm considering > it an error to call the function with non-page-aligned addresses and/ > or end < start (I take it that page-aligned, but start == end is not a > problem without your change). if ps == pe, then emfn == (smfn - 1). This will result to the number of pages of -1. There is a similar check in init_xenheap_pages, it doesn't seem harmfull to let it here. -- Julien Grall