From: Juergen Gross <jgross@suse.com>
To: Wei Liu <wei.liu2@citrix.com>, Andrew Cooper <andrew.cooper3@citrix.com>
Cc: ian.jackson@eu.citrix.com, xen-devel@lists.xen.org
Subject: Re: [PATCH] libxl: use llabs() instead abs() for int64_t argument
Date: Wed, 3 Aug 2016 11:27:04 +0200 [thread overview]
Message-ID: <0d410f5c-3026-52e6-588b-4ae32a07dbb9@suse.com> (raw)
In-Reply-To: <20160803091303.GU22419@citrix.com>
On 03/08/16 11:13, Wei Liu wrote:
> On Tue, Aug 02, 2016 at 06:28:37PM +0100, Andrew Cooper wrote:
>> 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)
>> ^
>
> Juergen, I can fix up the commit message for you, if you don't object to
> Andrew's suggestion.
No, I don't object.
Thanks,
Juergen
>
> ---
> 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.
>
> 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)
> ---
>
> Wei.
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-08-03 9:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-02 17:25 [PATCH] libxl: use llabs() instead abs() for int64_t argument Juergen Gross
2016-08-02 17:28 ` Andrew Cooper
2016-08-03 9:13 ` Wei Liu
2016-08-03 9:27 ` Juergen Gross [this message]
2016-08-03 9:48 ` Wei Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0d410f5c-3026-52e6-588b-4ae32a07dbb9@suse.com \
--to=jgross@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).