[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] x86: fix off-by-one error when printing memory ranges



On Wed, Feb 05, 2020 at 09:12:50AM +0100, Jan Beulich wrote:
> On 04.02.2020 18:19, Wei Liu wrote:
> > On Tue, Feb 04, 2020 at 06:07:00PM +0100, Jan Beulich wrote:
> >> On 04.02.2020 17:55, Wei Liu wrote:
> >>> Signed-off-by: Wei Liu <liuwe@xxxxxxxxxxxxx>
> >>> ---
> >>>  xen/arch/x86/e820.c | 2 +-
> >>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>>
> >>> diff --git a/xen/arch/x86/e820.c b/xen/arch/x86/e820.c
> >>> index b9f589cac3..d67387f137 100644
> >>> --- a/xen/arch/x86/e820.c
> >>> +++ b/xen/arch/x86/e820.c
> >>> @@ -94,7 +94,7 @@ static void __init print_e820_memory_map(struct 
> >>> e820entry *map, unsigned int ent
> >>>      for (i = 0; i < entries; i++) {
> >>>          printk(" %016Lx - %016Lx ",
> >>>                 (unsigned long long)(map[i].addr),
> >>> -               (unsigned long long)(map[i].addr + map[i].size));
> >>> +               (unsigned long long)(map[i].addr + map[i].size) - 1);
> >>
> >> Why was this an error? If we used [,] like Linux does - sure.
> >> But we don't. The presentation, without looking at the source,
> >> simply leaves open whether this was meant to be [,] or [,).
> >> And it continues to be left open with the adjustment made.
> >>
> > 
> > Well, Linux's representation is not what is normally done in math
> > either.
> > 
> > It is like
> > 
> >   Xen: [mem 0x0000000000000000-0x000000000009efff] usable
> > 
> > Note it is using '-', not ','. And there is "mem" at the beginning.
> > 
> > I have always interpreted the [] pair as something to enclose the range,
> > not of mathematically meaning.
> > 
> > If you want, I can change Xen's format string to "[%016Lx, %016Lx]".
> 
> I think this would make things less ambiguous, yes. But my primary
> request here is to have neither "fix" nor "error" nor anything
> alike in the title or description.

OK. I can certainly change the subject line to

  x86: subtract 1 when printing e820 ranges

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.