x86/dom0: change align type to int
PATCH 1/1 x86/dom0: change align type to int
There's no reason to use long to store the alignment, since the bigger page size is 1GB, and the alignment is stored as a frame number.
---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Wei Liu <[email protected]>
--- xen/arch/x86/hvm/dom0_build.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
xen/arch/x86/hvm/dom0_build.c +1 -2
@@ -92,8 +92,7 @@ static int __init pvh_populate_memory_range(struct domain *d, unsigned long nr_pages) {struct { -unsigned long align; -unsigned int order; +unsigned int align, order; }static const __initconst orders[] = {/* NB: must be sorted by decreasing size. */ { .align =PFN_DOWN (GB (1 )), .order =PAGE_ORDER_1G },
Signature · 7 lines
2.17.2 (Apple Git-113) _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 04.01.19 at 16:14, <[email protected]> wrote:
There's no reason to use long to store the alignment, since the bigger
biggest?
Quoted 17 lines
page size is 1GB, and the alignment is stored as a frame number.
Reported-by Jan Beulich <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Wei Liu <[email protected]>--- xen/arch/x86/hvm/dom0_build.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)xen/arch/x86/hvm/dom0_build.c +0
-0
xen/arch/x86/hvm/dom0_build.c static int __init pvh_populate_memory_range(struct domain *d, · line 98
Quoted 9 lines
xen/arch/x86/hvm/dom0_build.c +1
-2@@ -92,8 +92,7 @@ static int __init pvh_populate_memory_range(struct domain *d, unsigned long nr_pages) {struct { -unsigned long align; -unsigned int order; +unsigned int align, order; }static const __initconst orders[] = {/* NB: must be sorted by decreasing size. */ { .align =PFN_DOWN (GB (1 )), .order =PAGE_ORDER_1G },
That's not enough afaict, you also need to use 1UL in
end = (start + nr_pages) & ~(orders[0].align - 1);
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 34 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 04.01.19 at 16:14, <[email protected]> wrote:
There's no reason to use long to store the alignment, since the bigger
biggest?
Quoted 17 lines
page size is 1GB, and the alignment is stored as a frame number.
Reported-by Jan Beulich <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Wei Liu <[email protected]>--- xen/arch/x86/hvm/dom0_build.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)xen/arch/x86/hvm/dom0_build.c +0
-0xen/arch/x86/hvm/dom0_build.c static int __init pvh_populate_memory_range(struct domain *d, · line 98
Quoted 9 lines
xen/arch/x86/hvm/dom0_build.c +1
-2@@ -92,8 +92,7 @@ static int __init pvh_populate_memory_range(struct domain *d, unsigned long nr_pages) {struct { -unsigned long align; -unsigned int order; +unsigned int align, order; }static const __initconst orders[] = {/* NB: must be sorted by decreasing size. */ { .align =PFN_DOWN (GB (1 )), .order =PAGE_ORDER_1G },That's not enough afaict, you also need to use 1UL in
Quoted 1 line
end = (start + nr_pages) & ~(orders[0].align - 1);
Right, I'm afraid I prefer to keep align as unsigned long in order to avoid such mistakes.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel