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

[xen master] device-tree: fix infinite loop issue in 'assign_shared_memory()'



commit 30f5b19f41ee4c5e639ef49878c63e99bc5f6ce5
Author:     Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>
AuthorDate: Mon Sep 1 09:26:45 2025 +0000
Commit:     Michal Orzel <michal.orzel@xxxxxxx>
CommitDate: Thu Sep 4 10:20:01 2025 +0200

    device-tree: fix infinite loop issue in 'assign_shared_memory()'
    
    Fix an issue in the 'fail:' cleanup path of the 'assign_shared_memory()'
    function where the use of an unsigned long 'i' with the condition
    '--i >= 0' caused an infinite loop. Update the loop to use 'i--',
    ensuring correct loop termination.
    
    This change adheres to MISRA C Rule 14.3: "Controlling expressions shall
    not be invariant."
    
    Fixes: 041957bad382 ("xen/arm: Add additional reference to owner domain 
when the owner is allocated")
    Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>
    Acked-by: Michal Orzel <michal.orzel@xxxxxxx>
---
 xen/common/device-tree/static-shmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/device-tree/static-shmem.c 
b/xen/common/device-tree/static-shmem.c
index 8023c0a484..79f23caa77 100644
--- a/xen/common/device-tree/static-shmem.c
+++ b/xen/common/device-tree/static-shmem.c
@@ -185,7 +185,7 @@ static int __init assign_shared_memory(struct domain *d, 
paddr_t gbase,
     return 0;
 
  fail:
-    while ( --i >= 0 )
+    while ( i-- )
         put_page_nr(page + i, nr_borrowers);
     return ret;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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