public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] [opcodes] ARC + PPC: Fix -Walloc-size warnings
@ 2023-11-21 16:55 Jan-Benedict Glaw
  0 siblings, 0 replies; only message in thread
From: Jan-Benedict Glaw @ 2023-11-21 16:55 UTC (permalink / raw)
  To: bfd-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=54195469c18ec9873cc5ba6907f768509473fa9b

commit 54195469c18ec9873cc5ba6907f768509473fa9b
Author: Jan-Benedict Glaw <jbglaw@lug-owl.de>
Date:   Tue Nov 21 17:53:44 2023 +0100

    [opcodes] ARC + PPC: Fix -Walloc-size warnings
    
    Recently, -Walloc-size warnings started to kick in. Fix these two
    calloc() calls to match the intended usage pattern.
    
    opcodes/ChangeLog:
    
            * arc-dis.c (init_arc_disasm_info): Fix calloc() call.
            * ppc-dis.c (powerpc_init_dialect): Ditto.

Diff:
---
 opcodes/arc-dis.c | 2 +-
 opcodes/ppc-dis.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/opcodes/arc-dis.c b/opcodes/arc-dis.c
index 59b668ff64e..7498e75cee2 100644
--- a/opcodes/arc-dis.c
+++ b/opcodes/arc-dis.c
@@ -147,7 +147,7 @@ static bool
 init_arc_disasm_info (struct disassemble_info *info)
 {
   struct arc_disassemble_info *arc_infop
-    = calloc (sizeof (*arc_infop), 1);
+    = calloc (1, sizeof (*arc_infop));
 
   if (arc_infop == NULL)
     return false;
diff --git a/opcodes/ppc-dis.c b/opcodes/ppc-dis.c
index d97137d8b71..4d5652ebfeb 100644
--- a/opcodes/ppc-dis.c
+++ b/opcodes/ppc-dis.c
@@ -348,7 +348,7 @@ powerpc_init_dialect (struct disassemble_info *info)
 {
   ppc_cpu_t dialect = 0;
   ppc_cpu_t sticky = 0;
-  struct dis_private *priv = calloc (sizeof (*priv), 1);
+  struct dis_private *priv = calloc (1, sizeof (*priv));
 
   if (priv == NULL)
     return;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-11-21 16:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-21 16:55 [binutils-gdb] [opcodes] ARC + PPC: Fix -Walloc-size warnings Jan-Benedict Glaw

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).