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

[xen staging] x86/PVH: Use unsigned int for dom0 e820 index



commit 480179bc26f52cb598811173ec7fdc21adecfb13
Author:     Jason Andryuk <jason.andryuk@xxxxxxx>
AuthorDate: Mon Apr 22 15:11:02 2024 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Apr 22 15:11:02 2024 +0200

    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 <jbeulich@xxxxxxxx>
    Signed-off-by: Jason Andryuk <jason.andryuk@xxxxxxx>
    Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/arch/x86/hvm/dom0_build.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index d158f4d241..ac71d43a6b 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -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;
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

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