libxl: use llabs() instead abs() for int64_t argument

Commit 57f8b13c72 ("libxl: memory size
in kb requires 64 bit variable") introduced a bug: abs() shouldn't
be called with an int64_t argument. llabs() is to be used here.

Caught by clang build with error message:

libxl.c:4198:33: error: absolute value function 'abs' given an argument
of type
    'int64_t' (aka 'long') but has parameter of type 'int' which may cause
    truncation of value [-Werror,-Wabsolute-value]
    if (target_memkb < 0 && abs(target_memkb) > current_target_memkb)

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
This commit is contained in:
Juergen Gross authored and Wei Liu committed 2016-08-03 10:46:58 +01:00
1 parent e9522e4932
commit 45a348ebab
1 file changed
+1 -1
+1 -1
View File
@@ -4195,7 +4195,7 @@ retry_transaction:
videoram = videoram_s ? atoi(videoram_s) : 0;
if (relative) {
if (target_memkb < 0 && abs(target_memkb) > current_target_memkb)
if (target_memkb < 0 && llabs(target_memkb) > current_target_memkb)
new_target_memkb = 0;
else
new_target_memkb = current_target_memkb + target_memkb;
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.