From aa5a36b118ade63ebb189a8a51ef5e9c7ea30505 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 22 Jan 2024 00:12:45 +0100 Subject: [PATCH] libsframe: Fix calloc argument order in dump_sframe_header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GCC14 warns about the order of the arguments to calloc libsframe/sframe-dump.c: In function ‘dump_sframe_header’: libsframe/sframe-dump.c:70:39: warning: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Wcalloc-transposed-args] 70 | flags_str = (char*) calloc (sizeof (char), SFRAME_HEADER_FLAGS_STR_MAX_LEN); | ^~~~ libsframe/sframe-dump.c:70:39: note: earlier argument should specify number of elements, later size of each element Fix this by swapping the size and count arguments. libsframe/ * sframe-dump.c (dump_sframe_header): Swap arguments to calloc --- libsframe/sframe-dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsframe/sframe-dump.c b/libsframe/sframe-dump.c index 0d596918f72..42a086a5691 100644 --- a/libsframe/sframe-dump.c +++ b/libsframe/sframe-dump.c @@ -67,7 +67,7 @@ dump_sframe_header (sframe_decoder_ctx *sfd_ctx) /* Prepare SFrame section flags string. */ flags = header->sfh_preamble.sfp_flags; - flags_str = (char*) calloc (sizeof (char), SFRAME_HEADER_FLAGS_STR_MAX_LEN); + flags_str = (char*) calloc (SFRAME_HEADER_FLAGS_STR_MAX_LEN, sizeof (char)); if (flags) { if (flags & SFRAME_F_FDE_SORTED)