From: Ian Campbell Subject: Re: [PATCH] xen: arm: handle initrd addresses above the 4G boundary Date: Mon, 9 Dec 2013 14:00:52 +0000 Message-ID: <1386597652.7812.2.camel@kazak.uk.xensource.com> References: <1386254540-14231-1-git-send-email-ian.campbell@citrix.com> <52A1F238.90900@linaro.org> <1386349114.6672.61.camel@kazak.uk.xensource.com> <52A20BE5.6020702@linaro.org> <1386587735.30459.10.camel@kazak.uk.xensource.com> <52A5CB15.6020301@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <52A5CB15.6020301@linaro.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: Julien Grall Cc: stefano.stabellini@eu.citrix.com, tim@xen.org, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Mon, 2013-12-09 at 13:52 +0000, Julien Grall wrote: > > On 12/09/2013 11:15 AM, Ian Campbell wrote: > > On Fri, 2013-12-06 at 17:39 +0000, Julien Grall wrote: > >>>> Perhaps you update the comment by saying we are assuming bytes is 4-byte > >>>> aligned. > >>> > >>> Maybe it would be better to round up? > >> > >> No because if we round up, we would read to much data. dt_read_number is > >> not able to check the size. > > > > Right. > > > > I think what I shall do is change the caller to accept exactly > > sizeof(u32) or sizeof(u64) bytes and not any value between. > > It's fine to have size between sizeof(u32) or sizeof(u64), the address > will just be truncated. > > We have several location in Xen, where we rely on this behavior. Do you have examples? Since dt_read_number can't cope with anything which isn't a multiple of 32-bits I don't see a problem with rejecting them early instead of waiting until later and failing with an obscure error because an address has been truncated. Ian.