|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] libxl: use llabs() instead abs() for int64_t argument
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.
---
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@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |