x86: fix off-by-one error when printing memory ranges
PATCH 1/1 x86: fix off-by-one error when printing memory ranges
--- xen/arch/x86/e820.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/e820.c +1 -1
@@ -94,7 +94,7 @@ static void __init print_e820_memory_map(struct e820entry *map, unsigned int entfor (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 );switch (map[i].type) {case E820_RAM :printk ("(usable)\n" );
Signature · 7 lines
2.20.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 1 line · Wei Liu
Signed-off-by Wei Liu <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 10 lines · Wei Liu
Signed-off-by Wei Liu <[email protected]>--- xen/arch/x86/e820.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)xen/arch/x86/e820.c +0
-0
xen/arch/x86/e820.c static void __init print_e820_memory_map(struct e820entry *map, unsigned int ent · line 97
Quoted 5 lines
xen/arch/x86/e820.c +1
-1@@ -94,7 +94,7 @@ static void __init print_e820_memory_map(struct e820entry *map, unsigned int entfor (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.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 6 lines · Jan Beulich
Quoted 5 lines · Wei Liu
Signed-off-by Wei Liu <[email protected]>--- xen/arch/x86/e820.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines
xen/arch/x86/e820.c static void __init print_e820_memory_map(struct e820entry *map, unsigned int ent · line 97
Quoted 10 lines
xen/arch/x86/e820.c +1
-1@@ -94,7 +94,7 @@ static void __init print_e820_memory_map(struct e820entry *map, unsigned int entfor (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]".
Wei.
Quoted 1 line
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 29 lines · Wei Liu
Quoted 6 lines · Jan Beulich
Quoted 5 lines · Wei Liu
Signed-off-by Wei Liu <[email protected]>--- xen/arch/x86/e820.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 16 lines
xen/arch/x86/e820.c static void __init print_e820_memory_map(struct e820entry *map, unsigned int ent · line 97
Quoted 10 lines
xen/arch/x86/e820.c +1
-1@@ -94,7 +94,7 @@ static void __init print_e820_memory_map(struct e820entry *map, unsigned int entfor (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
Quoted 8 lines
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.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 34 lines · Jan Beulich
Quoted 33 lines · Wei Liu
Quoted 6 lines · Jan Beulich
Quoted 5 lines · Wei Liu
Signed-off-by Wei Liu <[email protected]>--- xen/arch/x86/e820.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 16 lines
xen/arch/x86/e820.c static void __init print_e820_memory_map(struct e820entry *map, unsigned int ent · line 97
Quoted 10 lines
xen/arch/x86/e820.c +1
-1@@ -94,7 +94,7 @@ static void __init print_e820_memory_map(struct e820entry *map, unsigned int entfor (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.
Quoted 8 lines
Quoted 4 lines
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
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 40 lines · Wei Liu
Quoted 39 lines · Jan Beulich
Quoted 37 lines · Wei Liu
Quoted 6 lines · Jan Beulich
Quoted 5 lines · Wei Liu
Signed-off-by Wei Liu <[email protected]>--- xen/arch/x86/e820.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 16 lines
xen/arch/x86/e820.c static void __init print_e820_memory_map(struct e820entry *map, unsigned int ent · line 97
Quoted 10 lines
xen/arch/x86/e820.c +1
-1@@ -94,7 +94,7 @@ static void __init print_e820_memory_map(struct e820entry *map, unsigned int entfor (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]".
Quoted 7 lines
Quoted 3 lines
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
If I hear no further objections I will commit this patch with the above subject line today.
Wei.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 45 lines · Wei Liu
Quoted 44 lines · Wei Liu
Quoted 42 lines · Jan Beulich
Quoted 29 lines · Wei Liu
Quoted 6 lines · Jan Beulich
Quoted 5 lines · Wei Liu
Signed-off-by Wei Liu <[email protected]>--- xen/arch/x86/e820.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 16 lines
xen/arch/x86/e820.c static void __init print_e820_memory_map(struct e820entry *map, unsigned int ent · line 97
Quoted 10 lines
xen/arch/x86/e820.c +1
-1@@ -94,7 +94,7 @@ static void __init print_e820_memory_map(struct e820entry *map, unsigned int entfor (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
Quoted 8 lines
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.
Quoted 6 lines
Quoted 3 lines
OK. I can certainly change the subject line to
x86: subtract 1 when printing e820 ranges
If I hear no further objections I will commit this patch with the above subject line today.
And with the presentation changed to [,]?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 46 lines · Jan Beulich
Quoted 45 lines · Wei Liu
Quoted 44 lines · Wei Liu
Quoted 42 lines · Jan Beulich
Quoted 29 lines · Wei Liu
Quoted 6 lines · Jan Beulich
Quoted 5 lines · Wei Liu
Signed-off-by Wei Liu <[email protected]>--- xen/arch/x86/e820.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 16 lines
xen/arch/x86/e820.c static void __init print_e820_memory_map(struct e820entry *map, unsigned int ent · line 97
Quoted 10 lines
xen/arch/x86/e820.c +1
-1@@ -94,7 +94,7 @@ static void __init print_e820_memory_map(struct e820entry *map, unsigned int entfor (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
Quoted 8 lines
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.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
OK. I can certainly change the subject line to
x86: subtract 1 when printing e820 ranges
If I hear no further objections I will commit this patch with the above subject line today.
And with the presentation changed to [,]?
Fine by me too. I will post a new patch shortly.
Wei.
Quoted 2 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel