]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
libsframe: Fix calloc argument order in dump_sframe_header
authorMark Wielaard <mark@klomp.org>
Sun, 21 Jan 2024 23:12:45 +0000 (00:12 +0100)
committerMark Wielaard <mark@klomp.org>
Mon, 22 Jan 2024 17:19:03 +0000 (18:19 +0100)
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

index 0d596918f721a3efdad458773be7b1185ea2708d..42a086a5691fcfc32fb3754780ceaf9a24937d78 100644 (file)
@@ -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)