From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id C69163858D3C for ; Sun, 21 Jan 2024 23:16:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C69163858D3C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C69163858D3C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=45.83.234.184 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705878992; cv=none; b=J219aw1emXNWsFoQ6tq72NujMPvcK9okyyqfu9kl8xYgyNkjSxzegxazwGUFsVOzp+LTm8kaGD0Qf/9ZfVvzRStq9eaaQKX3HMLtLgCLnCm4rZdgOAWmMQQTymAV8x0MnWhaTyVmzSMMphuzySalVNCzEIAv7XfSpLEfhtCWuZU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705878992; c=relaxed/simple; bh=yzQRQ/1R24lj6F7UuJr1kP0CToRamtd1d7og6L0jAU8=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=ktbUCcUV2upalw7VrIA4Zt4005zgc2n8RtVf1rlP5jTiQdzYF6vqecYBg2Ir94kzxtgCAWPNE0y4PJDNufE64ei1XXM5ZROHPij9AUa3fZPZmFohKWAE4d+DXTAnJ2uVBRwnwgDXKkNqk3BndRp+AxIE0dNjUgfyunkr0NIyyRY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from csb.redhat.com (deer0x03.wildebeest.org [172.31.17.133]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id AFC88302BBEA; Mon, 22 Jan 2024 00:16:29 +0100 (CET) Received: by csb.redhat.com (Postfix, from userid 10916) id 6E935CEF2C; Mon, 22 Jan 2024 00:16:29 +0100 (CET) From: Mark Wielaard To: binutils@sourceware.org Cc: Indu Bhagat , Mark Wielaard Subject: [PATCH] libsframe: Fix calloc argument order in dump_sframe_header Date: Mon, 22 Jan 2024 00:16:21 +0100 Message-Id: <20240121231621.576801-1-mark@klomp.org> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.3 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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