Re: [PATCH 2/2] selftests: cgroup: use function 'labs()' over 'abs()'

From: Christian Brauner
Date: Tue Nov 09 2021 - 10:02:21 EST


On Fri, Nov 05, 2021 at 05:25:30PM +0100, Anders Roxell wrote:
> When building selftests/cgroup with clang, the compiler warn about the
> function abs() see below:
>
> In file included from test_memcontrol.c:21:
> ./cgroup_util.h:16:9: warning: absolute value function 'abs' given an argument of type 'long' but has parameter of type 'int' which may cause truncation of value [-Wabsolute-value]
> return abs(a - b) <= (a + b) / 100 * err;
> ^
> ./cgroup_util.h:16:9: note: use function 'labs' instead
> return abs(a - b) <= (a + b) / 100 * err;
> ^~~
> labs
>
> The note indicates what to do, Rework to use the function 'labs()'.
>
> Signed-off-by: Anders Roxell <anders.roxell@xxxxxxxxxx>
> ---

Thanks!
Acked-by: Christian Brauner <christian.brauner@xxxxxxxxxx>