Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v3 1/2] package/iproute2: fix building error using designated initializers
@ 2024-09-23  5:46 Dario Binacchi
  2024-09-23  5:46 ` [Buildroot] [PATCH v3 2/2] package/iproute2: bump to version 6.11.0 Dario Binacchi
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Dario Binacchi @ 2024-09-23  5:46 UTC (permalink / raw)
  To: buildroot; +Cc: Petr Vorel, Dario Binacchi, linux-amarula

This patch fixes the following error:

arpd.c:442:17: error: initialization of 'int' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
  442 |                 NULL,   0,

The analysis of socket.h [1] containing the msghdr structure shows that
it has been modified with the addition of padding fields, which cause
the compilation error:

struct msghdr {
	void *msg_name;
	socklen_t msg_namelen;
	struct iovec *msg_iov;
#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __BIG_ENDIAN
	int __pad1;
#endif
	int msg_iovlen;
#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __LITTLE_ENDIAN
	int __pad1;
#endif
	void *msg_control;
#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __BIG_ENDIAN
	int __pad2;
#endif
	socklen_t msg_controllen;
#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __LITTLE_ENDIAN
	int __pad2;
#endif
	int msg_flags;
};

The use of designated initializers allows the issue to be fixed.

[1] iproute2/host/mips64-buildroot-linux-musl/sysroot/usr/include/sys/socket.h

Fixes:
- http://autobuild.buildroot.org/results/e4cdfa38ae9578992f1c0ff5c4edae3cc0836e3c

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
No changes since v1

 ...ted-initializers-for-msghdr-structur.patch | 70 +++++++++++++++++++
 1 file changed, 70 insertions(+)
 create mode 100644 package/iproute2/0003-arpd-use-designated-initializers-for-msghdr-structur.patch

diff --git a/package/iproute2/0003-arpd-use-designated-initializers-for-msghdr-structur.patch b/package/iproute2/0003-arpd-use-designated-initializers-for-msghdr-structur.patch
new file mode 100644
index 000000000000..f8b9f7d08877
--- /dev/null
+++ b/package/iproute2/0003-arpd-use-designated-initializers-for-msghdr-structur.patch
@@ -0,0 +1,70 @@
+From 13cea6bb5e4f08f534fa4b04b5fc4ea0c8a2467b Mon Sep 17 00:00:00 2001
+From: Dario Binacchi <dario.binacchi@amarulasolutions.com>
+Date: Wed, 18 Sep 2024 14:22:34 +0200
+Subject: [PATCH] arpd: use designated initializers for msghdr structure
+
+This patch fixes the following error:
+
+arpd.c:442:17: error: initialization of 'int' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
+  442 |                 NULL,   0,
+
+raised by Buildroot autobuilder [1].
+
+In the case in question, the analysis of socket.h [2] containing the
+msghdr structure shows that it has been modified with the addition of
+padding fields, which cause the compilation error. The use of designated
+initializers allows the issue to be fixed.
+
+struct msghdr {
+	void *msg_name;
+	socklen_t msg_namelen;
+	struct iovec *msg_iov;
+#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __BIG_ENDIAN
+	int __pad1;
+#endif
+	int msg_iovlen;
+#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __LITTLE_ENDIAN
+	int __pad1;
+#endif
+	void *msg_control;
+#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __BIG_ENDIAN
+	int __pad2;
+#endif
+	socklen_t msg_controllen;
+#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __LITTLE_ENDIAN
+	int __pad2;
+#endif
+	int msg_flags;
+};
+
+[1] http://autobuild.buildroot.org/results/e4cdfa38ae9578992f1c0ff5c4edae3cc0836e3c/
+[2] iproute2/host/mips64-buildroot-linux-musl/sysroot/usr/include/sys/socket.h
+
+Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
+Upstream: https://lore.kernel.org/netdev/20240919132454.7394-1-dario.binacchi@amarulasolutions.com/T/#mac98a56b7ce0235a6e2b97afe8aa8565de4c926d
+---
+ misc/arpd.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/misc/arpd.c b/misc/arpd.c
+index e77ef53928a2..b4935c23eebb 100644
+--- a/misc/arpd.c
++++ b/misc/arpd.c
+@@ -437,10 +437,10 @@ static void get_kern_msg(void)
+ 	struct iovec iov;
+ 	char   buf[8192];
+ 	struct msghdr msg = {
+-		(void *)&nladdr, sizeof(nladdr),
+-		&iov,	1,
+-		NULL,	0,
+-		0
++		.msg_name = &nladdr, .msg_namelen = sizeof(nladdr),
++		.msg_iov = &iov, .msg_iovlen = 1,
++		.msg_control = (void *)NULL, .msg_controllen = 0,
++		.msg_flags = 0
+ 	};
+ 
+ 	iov.iov_base = buf;
+-- 
+2.43.0
+
-- 
2.43.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2024-10-26  8:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-23  5:46 [Buildroot] [PATCH v3 1/2] package/iproute2: fix building error using designated initializers Dario Binacchi
2024-09-23  5:46 ` [Buildroot] [PATCH v3 2/2] package/iproute2: bump to version 6.11.0 Dario Binacchi
2024-09-23  5:59   ` Baruch Siach via buildroot
2024-10-15 22:19   ` Petr Vorel
2024-10-15 22:12 ` [Buildroot] [PATCH v3 1/2] package/iproute2: fix building error using designated initializers Petr Vorel
2024-10-26  8:47 ` Thomas Petazzoni via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox