From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH] xen/arm: Correctly handle non-page aligned pointer in raw_copy_* Date: Tue, 18 Feb 2014 15:29:26 +0000 Message-ID: <53037C56.3080804@linaro.org> References: <1392397809-13255-1-git-send-email-julien.grall@linaro.org> <1392735576.11080.87.camel@kazak.uk.xensource.com> <1392735659.11080.88.camel@kazak.uk.xensource.com> <53037788.4010702@linaro.org> <1392737112.11080.102.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" 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 1WFmby-0002q3-Hx for xen-devel@lists.xenproject.org; Tue, 18 Feb 2014 15:29:30 +0000 Received: by mail-ea0-f181.google.com with SMTP id k10so5772650eaj.12 for ; Tue, 18 Feb 2014 07:29:28 -0800 (PST) In-Reply-To: <1392737112.11080.102.camel@kazak.uk.xensource.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: Ian Campbell Cc: xen-devel@lists.xenproject.org, tim@xen.org, george.dunlap@citrix.com, stefano.stabellini@citrix.com List-Id: xen-devel@lists.xenproject.org On 02/18/2014 03:25 PM, Ian Campbell wrote: > On Tue, 2014-02-18 at 15:08 +0000, Julien Grall wrote: >> On 02/18/2014 03:00 PM, Ian Campbell wrote: >>> On Tue, 2014-02-18 at 14:59 +0000, Ian Campbell wrote: >>> >>>>> As the offset is only computed one time per function, >>>> >>>> We set offset = 0 at the end of the first iteration. >>> >>> Ah, we do in raw_copy_to_guest_helper and raw_clear_guest but not >>> raw_copy_from_guest -- which I think is the actual bug here. >> >> I didn't notice the offset = 0 at then end of raw_copy_to_guest. >> >> I can send a patch to only set offset to 0 in raw_copy_from_guest. But I >> think it's less clear than this patch. What do you think? > > I think the approach currently used by the (non-buggy) functions is > better -- it makes it obvious that after the first iteration things > *have* to now be aligned. Ok. I will resend the patch. > I also wouldn't be surprised if the compiler had trouble proving this > and so ended up needlessly recalculating offset instead of optimising it > out. > > If you find the code unclear please feel free to add comments etc. I will add comment. -- Julien Grall