]> git.ipfire.org Git - thirdparty/libvirt.git/commit
util: fix two virCompareLimitUlong bugs
authorBing Bu Cao <mars@linux.vnet.ibm.com>
Fri, 11 Oct 2013 06:50:33 +0000 (14:50 +0800)
committerEric Blake <eblake@redhat.com>
Fri, 11 Oct 2013 12:34:18 +0000 (06:34 -0600)
commit19e7c04dce34afeb9a762471e09777de7d219db8
tree1190d92163078f09d9f00d0533bc4f29f5b31b00
parent1fb4d8923ff203d6bc31b1e1d89126e5670cb019
util: fix two virCompareLimitUlong bugs

The helper function virCompareLimitUlong compares limit values,
where value of 0 is equal to unlimited. If the latter parameter is 0,
it should return -1 instead of 1, hence the user can only set hard_limit when
swap_hard_limit currently is unlimited.

Worse, all callers pass 2 64-bit values, but on 32-bit platforms,
the second argument was silently truncated to 32 bits, which
could lead to incorrect computations.

Signed-off-by: Bing Bu Cao <mars@linux.vnet.ibm.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
src/util/virutil.c
src/util/virutil.h