summaryrefslogtreecommitdiffstats
path: root/build/external/patches
diff options
context:
space:
mode:
authornucleo <alekcejk@googlemail.com>2024-01-18 16:48:35 +0200
committerBeno�t Ganne <bganne@cisco.com>2024-01-19 08:39:46 +0000
commitca75cd83b51895e94326117cf116c5d25e6c77da (patch)
treefd0eb0ac7675b9a38bbc22f0663dd020676d39c6 /build/external/patches
parent77caeb1b193404e76beb27a1aa81321e8eb1cf1f (diff)
af_xdp: Backport xdp-tools fix transposed calloc() arguments
Fixes compilation error with GCC 14 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument Type: fix Change-Id: Ie328ecc711976547df2cffe17325b786bc7a8849 Signed-off-by: nucleo <alekcejk@googlemail.com>
Diffstat (limited to 'build/external/patches')
-rw-r--r--build/external/patches/xdp-tools_1.2.9/0004-Fix-transposed-calloc-arguments.patch54
1 files changed, 54 insertions, 0 deletions
diff --git a/build/external/patches/xdp-tools_1.2.9/0004-Fix-transposed-calloc-arguments.patch b/build/external/patches/xdp-tools_1.2.9/0004-Fix-transposed-calloc-arguments.patch
new file mode 100644
index 00000000000..1e9c1500562
--- /dev/null
+++ b/build/external/patches/xdp-tools_1.2.9/0004-Fix-transposed-calloc-arguments.patch
@@ -0,0 +1,54 @@
+From b184d103bd767e2286cdb2b0639a2470dce205d5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= <toke@redhat.com>
+Date: Thu, 18 Jan 2024 13:22:47 +0100
+Subject: [PATCH] Fix transposed calloc() arguments
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Calls to calloc() are supposed to have the number of elements as the first
+argument, but we erroneously transposed the arguments in a couple of places. It
+seems GCC 14 has started to warn about this, which exposed this as build
+breakage.
+
+Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
+---
+ lib/util/params.c | 2 +-
+ lib/util/xpcapng.c | 6 +++---
+ xdp-trafficgen/xdp-trafficgen.c | 4 ++--
+ 3 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/lib/util/xpcapng.c b/lib/util/xpcapng.c
+index e453b88..8cfc947 100644
+--- a/lib/util/xpcapng.c
++++ b/lib/util/xpcapng.c
+@@ -226,7 +226,7 @@ static bool pcapng_write_shb(struct xpcapng_dumper *pd, const char *comment,
+ shb_length += sizeof(uint32_t);
+
+ /* Allocate the SHB and fill it. */
+- shb = calloc(shb_length, 1);
++ shb = calloc(1, shb_length);
+ if (shb == NULL) {
+ errno = ENOMEM;
+ return false;
+@@ -318,7 +318,7 @@ static bool pcapng_write_idb(struct xpcapng_dumper *pd, const char *name,
+ idb_length += sizeof(uint32_t);
+
+ /* Allocate the IDB and fill it. */
+- idb = calloc(idb_length, 1);
++ idb = calloc(1, idb_length);
+ if (idb == NULL) {
+ errno = ENOMEM;
+ return false;
+@@ -549,7 +549,7 @@ struct xpcapng_dumper *xpcapng_dump_open(const char *file,
+ goto error_exit;
+ }
+
+- pd = calloc(sizeof(*pd), 1);
++ pd = calloc(1, sizeof(*pd));
+ if (pd == NULL) {
+ errno = ENOMEM;
+ goto error_exit;
+--
+2.43.0
+