mirror_zfs/cmd/zpool
Ryan Moeller 73d7820bba Use signed types to prevent subtraction overflow
The difference between the sizes could be positive or negative. Leaving
the types as unsigned means the result overflows when the difference is
negative and removing the labs() means we'll have introduced a bug. The
subtraction results in the correct value when the unsigned integer is
interpreted as a signed integer by labs().

Clang doesn't see that we're doing a subtraction and abusing the types.
It sees the result of the subtraction, an unsigned value, being passed
to an absolute value function and emits a warning which we treat as an
error.

Reviewed by: Youzhong Yang <youzhong@gmail.com>
Reviewed-by: Igor Kozhukhov <igor@dilos.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <ryan@ixsystems.com>
Closes #9355
2019-09-22 15:27:53 -07:00
..
zpool.d shellcheck pass 2019-02-04 09:07:19 -08:00
.gitignore Add .gitignore files to exclude build products 2010-01-08 11:35:17 -08:00
Makefile.am Tunable directory for zfs runtime scripts 2018-06-07 09:59:59 -07:00
zpool_iter.c Add libzutil for libzfs or libzpool consumers 2018-11-05 11:22:33 -08:00
zpool_main.c Refactor libzfs_error_init newlines 2019-09-18 09:05:57 -07:00
zpool_util.c Add libtpool (thread pools) 2017-08-09 15:31:08 -07:00
zpool_util.h Add libtpool (thread pools) 2017-08-09 15:31:08 -07:00
zpool_vdev.c Use signed types to prevent subtraction overflow 2019-09-22 15:27:53 -07:00