1 From b184d103bd767e2286cdb2b0639a2470dce205d5 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= <toke@redhat.com>
3 Date: Thu, 18 Jan 2024 13:22:47 +0100
4 Subject: [PATCH] Fix transposed calloc() arguments
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 Calls to calloc() are supposed to have the number of elements as the first
10 argument, but we erroneously transposed the arguments in a couple of places. It
11 seems GCC 14 has started to warn about this, which exposed this as build
14 Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
16 lib/util/params.c | 2 +-
17 lib/util/xpcapng.c | 6 +++---
18 xdp-trafficgen/xdp-trafficgen.c | 4 ++--
19 3 files changed, 6 insertions(+), 6 deletions(-)
21 diff --git a/lib/util/xpcapng.c b/lib/util/xpcapng.c
22 index e453b88..8cfc947 100644
23 --- a/lib/util/xpcapng.c
24 +++ b/lib/util/xpcapng.c
25 @@ -226,7 +226,7 @@ static bool pcapng_write_shb(struct xpcapng_dumper *pd, const char *comment,
26 shb_length += sizeof(uint32_t);
28 /* Allocate the SHB and fill it. */
29 - shb = calloc(shb_length, 1);
30 + shb = calloc(1, shb_length);
34 @@ -318,7 +318,7 @@ static bool pcapng_write_idb(struct xpcapng_dumper *pd, const char *name,
35 idb_length += sizeof(uint32_t);
37 /* Allocate the IDB and fill it. */
38 - idb = calloc(idb_length, 1);
39 + idb = calloc(1, idb_length);
43 @@ -549,7 +549,7 @@ struct xpcapng_dumper *xpcapng_dump_open(const char *file,
47 - pd = calloc(sizeof(*pd), 1);
48 + pd = calloc(1, sizeof(*pd));