From: Andrew Cooper Subject: Re: [PATCH] libxl: use llabs() instead abs() for int64_t argument Date: Tue, 2 Aug 2016 18:28:37 +0100 Message-ID: <9c60cfd2-7527-bc25-7a0c-83b5f7e5a082@citrix.com> References: <1470158742-27324-1-git-send-email-jgross@suse.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6026698422180419443==" Return-path: In-Reply-To: <1470158742-27324-1-git-send-email-jgross@suse.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: Juergen Gross , xen-devel@lists.xen.org Cc: wei.liu2@citrix.com, ian.jackson@eu.citrix.com List-Id: xen-devel@lists.xenproject.org --===============6026698422180419443== Content-Type: multipart/alternative; boundary="------------7701ADB898A7F9E42F6F1E3A" --------------7701ADB898A7F9E42F6F1E3A Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit On 02/08/16 18:25, Juergen Gross wrote: > Commit 57f8b13c724023c78fa15a80452d1de3e51a1418 ("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. Possibly worth identifying that this was caught by a clang build, citing: 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) ^ Otherwise, LGTM. ~Andrew --------------7701ADB898A7F9E42F6F1E3A Content-Type: text/html; charset="windows-1252" Content-Transfer-Encoding: 8bit
On 02/08/16 18:25, Juergen Gross wrote:
Commit 57f8b13c724023c78fa15a80452d1de3e51a1418 ("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.

Possibly worth identifying that this was caught by a clang build, citing:

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)
                                         ^
Otherwise, LGTM.

~Andrew
--------------7701ADB898A7F9E42F6F1E3A-- --===============6026698422180419443== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwczovL2xpc3RzLnhlbi5v cmcveGVuLWRldmVsCg== --===============6026698422180419443==--