[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] libxenguest: complete loops in xc_map_domain_meminfo()
commit 1a838bf72584788310496ba5f3d865457c80727f Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Fri Aug 13 16:49:10 2021 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Fri Aug 13 16:49:10 2021 +0200 libxenguest: complete loops in xc_map_domain_meminfo() minfo->p2m_size may have more than 31 significant bits. Change the induction variable to unsigned long, and (largely for signed-ness consistency) a helper variable to unsigned int. While there also avoid open-coding min(). Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- tools/libs/guest/xg_domain.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/libs/guest/xg_domain.c b/tools/libs/guest/xg_domain.c index 155e337427..f0e7748449 100644 --- a/tools/libs/guest/xg_domain.c +++ b/tools/libs/guest/xg_domain.c @@ -40,7 +40,7 @@ int xc_map_domain_meminfo(xc_interface *xch, uint32_t domid, xc_dominfo_t info; shared_info_any_t *live_shinfo; xen_capabilities_info_t xen_caps = ""; - int i; + unsigned long i; /* Only be initialized once */ if ( minfo->pfn_type || minfo->p2m_table ) @@ -116,12 +116,11 @@ int xc_map_domain_meminfo(xc_interface *xch, uint32_t domid, /* Retrieve PFN types in batches */ for ( i = 0; i < minfo->p2m_size ; i+=1024 ) { - int count = ((minfo->p2m_size - i ) > 1024 ) ? - 1024: (minfo->p2m_size - i); + unsigned int count = min(minfo->p2m_size - i, 1024UL); if ( xc_get_pfn_type_batch(xch, domid, count, minfo->pfn_type + i) ) { - PERROR("Could not get %d-eth batch of PFN types", (i+1)/1024); + PERROR("Could not get batch %lu of PFN types", (i + 1) / 1024); goto failed; } } -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |