mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
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: 041957bad3 ("xen/arm: Add additional reference to owner domain when the owner is allocated")
Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@epam.com>
Acked-by: Michal Orzel <michal.orzel@amd.com>
This commit is contained in:
1 parent
1e9635b044
commit
30f5b19f41
1 file changed
+1
-1
@@ -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;
|
||||
}
|
||||
|
||||