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:
Dmytro Prokopchuk1 authored and Michal Orzel committed 2025-09-04 10:20:01 +02:00
1 parent 1e9635b044
commit 30f5b19f41
1 file changed
+1 -1
+1 -1
View File
@@ -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;
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.