x86/PVH: Use unsigned int for dom0 e820 index
PATCH 1/1 x86/PVH: Use unsigned int for dom0 e820 index
Switch to unsigned int for the dom0 e820 index. This eliminates the potential for array underflows, and the compiler might be able to generate better code.
Requested-by Jan Beulich <[email protected]>
Signed-off-by Jason Andryuk <[email protected]>
--- xen/arch/x86/hvm/dom0_build.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
xen/arch/x86/hvm/dom0_build.c +2 -2
@@ -569,7 +569,7 @@ static paddr_t __init find_kernel_memory( {paddr_t kernel_size = elf->dest_size;unsigned int align; -int i; +unsigned int i;if ( parms->phys_align !=UNSET_ADDR32 ) align = parms->phys_align;
@@ -579,7 +579,7 @@ static paddr_t __init find_kernel_memory( align =MB (2 );/* Search backwards to find the highest address. */ -for ( i = d->arch.nr_e820 -1 ; i >=0 ; i-- ) +for ( i = d->arch.nr_e820; i--; ) {paddr_t start = d->arch.e820[i].addr;paddr_t end = start + d->arch.e820[i].size;
Signature · 1 line
2.44.0
Quoted 6 lines · Jason Andryuk
Switch to unsigned int for the dom0 e820 index. This eliminates the potential for array underflows, and the compiler might be able to generate better code.
Requested-by Jan Beulich <[email protected]>Signed-off-by Jason Andryuk <[email protected]>
Acked-by Jan Beulich <[email protected]>