All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] iwpan: fix clang compiler warning on absolute-value
@ 2018-12-06 20:26 Stefan Schmidt
  2018-12-06 20:26 ` [PATCH 2/2] examples: fix wrongly used unsigned attribute Stefan Schmidt
  2018-12-19 13:33 ` [PATCH 1/2] iwpan: fix clang compiler warning on absolute-value Stefan Schmidt
  0 siblings, 2 replies; 4+ messages in thread
From: Stefan Schmidt @ 2018-12-06 20:26 UTC (permalink / raw)
  To: linux-wpan; +Cc: aring, Stefan Schmidt

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@datenfreihafen.org>
---
 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-12-19 13:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-06 20:26 [PATCH 1/2] iwpan: fix clang compiler warning on absolute-value Stefan Schmidt
2018-12-06 20:26 ` [PATCH 2/2] examples: fix wrongly used unsigned attribute Stefan Schmidt
2018-12-19 13:33   ` Stefan Schmidt
2018-12-19 13:33 ` [PATCH 1/2] iwpan: fix clang compiler warning on absolute-value Stefan Schmidt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.