lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Fri,  9 Feb 2024 11:24:47 +0100
From: Andrea Claudi <aclaudi@...hat.com>
To: netdev@...r.kernel.org
Cc: stephen@...workplumber.org,
	dsahern@...il.com,
	sgallagh@...hat.com
Subject: [PATCH] iproute2: fix build failure on ppc64le

ppc64le build fails with error on ifstat.c when
-Wincompatible-pointer-types is enabled:

ifstat.c: In function ‘dump_raw_db’:
ifstat.c:323:44: error: initialization of ‘long long unsigned int *’ from incompatible pointer type ‘__u64 *’ {aka ‘long unsigned int *’} [-Wincompatible-pointer-types]
  323 |                 unsigned long long *vals = n->val;

Several other warnings are produced when -Wformat= is set, for example:

ss.c:3244:34: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘__u64’ {aka ‘long unsigned int’} [-Wformat=]
 3244 |                 out(" rcv_nxt:%llu", s->mptcpi_rcv_nxt);
      |                               ~~~^   ~~~~~~~~~~~~~~~~~
      |                                  |    |
      |                                  |    __u64 {aka long unsigned int}
      |                                  long long unsigned int
      |                               %lu

This happens because __u64 is defined as long unsigned on ppc64le.  As
pointed out by Florian Weimar, we should use -D__SANE_USERSPACE_TYPES__
if we really want to use long long unsigned in iproute2.

This fix the build failure and all the warnings without any change on
the code itself.

Suggested-by: Florian Weimer <fweimer@...hat.com>
Signed-off-by: Andrea Claudi <aclaudi@...hat.com>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 8024d45e..3b9daede 100644
--- a/Makefile
+++ b/Makefile
@@ -60,7 +60,7 @@ CC := gcc
 HOSTCC ?= $(CC)
 DEFINES += -D_GNU_SOURCE
 # Turn on transparent support for LFS
-DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
+DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D__SANE_USERSPACE_TYPES__
 CCOPTS = -O2 -pipe
 WFLAGS := -Wall -Wstrict-prototypes  -Wmissing-prototypes
 WFLAGS += -Wmissing-declarations -Wold-style-definition -Wformat=2
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ