It looks like it could underflow at first glance. That is if i is zero and you get in the while loop with the i--. However the postfix expression is evaluated after the conditional so the loop is fine and won't execute (with i==0).
However in spirit of defense programming lets clarify the loop conditional. Signed-off-by: Konrad Rzeszutek Wilk <konrad.w...@oracle.com> --- Cc: Ian Jackson <ian.jack...@eu.citrix.com> Cc: Jan Beulich <jbeul...@suse.com> Cc: Keir Fraser <k...@xen.org> Cc: Tim Deegan <t...@xen.org> --- --- xen/common/vmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/common/vmap.c b/xen/common/vmap.c index c57239f..be01285 100644 --- a/xen/common/vmap.c +++ b/xen/common/vmap.c @@ -246,8 +246,8 @@ void *vmalloc(size_t size) return va; error: - while ( i-- ) - free_domheap_page(mfn_to_page(mfn_x(mfn[i]))); + while ( i ) + free_domheap_page(mfn_to_page(mfn_x(mfn[--i]))); xfree(mfn); return NULL; } -- 2.5.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel