From: Mark Wielaard <mark@klomp.org>
To: binutils@sourceware.org
Cc: Indu Bhagat <indu.bhagat@oracle.com>, Mark Wielaard <mark@klomp.org>
Subject: [PATCH] libsframe: Fix calloc argument order in dump_sframe_header
Date: Mon, 22 Jan 2024 00:16:21 +0100 [thread overview]
Message-ID: <20240121231621.576801-1-mark@klomp.org> (raw)
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)
--
2.39.3
next reply other threads:[~2024-01-21 23:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-21 23:16 Mark Wielaard [this message]
2024-01-22 17:15 ` Nick Clifton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240121231621.576801-1-mark@klomp.org \
--to=mark@klomp.org \
--cc=binutils@sourceware.org \
--cc=indu.bhagat@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).