git: 360c47b956d8 - stable/14 - elftoolchain: Consistently use item count as the first argument to calloc

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Sat, 30 Nov 2024 16:51:16 UTC
The branch stable/14 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=360c47b956d8129305a69a2f8ff949bb39189af5

commit 360c47b956d8129305a69a2f8ff949bb39189af5
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-07-19 17:02:45 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-11-30 13:55:57 +0000

    elftoolchain: Consistently use item count as the first argument to calloc
    
    Reported by:    GCC 14 -Wcalloc-transposed-args
    Reviewed by:    rlibby, emaste
    Differential Revision:  https://reviews.freebsd.org/D46007
    
    (cherry picked from commit b73445a32f8a3648372c0042ef633fe61b38d135)
---
 contrib/elftoolchain/libdwarf/libdwarf_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/elftoolchain/libdwarf/libdwarf_init.c b/contrib/elftoolchain/libdwarf/libdwarf_init.c
index b85c87c59af0..95ed6147ba89 100644
--- a/contrib/elftoolchain/libdwarf/libdwarf_init.c
+++ b/contrib/elftoolchain/libdwarf/libdwarf_init.c
@@ -302,7 +302,7 @@ _dwarf_alloc(Dwarf_Debug *ret_dbg, int mode, Dwarf_Error *error)
 {
 	Dwarf_Debug dbg;
 
-	if ((dbg = calloc(sizeof(struct _Dwarf_Debug), 1)) == NULL) {
+	if ((dbg = calloc(1, sizeof(struct _Dwarf_Debug))) == NULL) {
 		DWARF_SET_ERROR(dbg, error, DW_DLE_MEMORY);
 		return (DW_DLE_MEMORY);
 	}