[PATCH 1/2] iwpan: fix clang compiler warning on absolute-value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Our CI found this when building with clang (seems to have
the option on by deafult)

iwpan.c:469:13: 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]
        cmd_size = abs((long)&__section_set - (long)&__section_get);
                   ^
iwpan.c:469:13: note: use function 'labs' instead
        cmd_size = abs((long)&__section_set - (long)&__section_get);
                   ^~~
                   labs

This also follows a change in iw, where we derived from.

Signed-off-by: Stefan Schmidt <stefan@xxxxxxxxxxxxxxxxxx>
---
 src/iwpan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/iwpan.c b/src/iwpan.c
index e7781fd..fb7bef1 100644
--- a/src/iwpan.c
+++ b/src/iwpan.c
@@ -466,7 +466,7 @@ int main(int argc, char **argv)
 	int err;
 
 	/* calculate command size including padding */
-	cmd_size = abs((long)&__section_set - (long)&__section_get);
+	cmd_size = labs((long)&__section_set - (long)&__section_get);
 	/* strip off self */
 	argc--;
 	argv0 = *argv++;
-- 
2.17.2




[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux