From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by sourceware.org (Postfix) with ESMTPS id BEE5E3858D28 for ; Fri, 22 Dec 2023 19:42:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BEE5E3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BEE5E3858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::62b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703274168; cv=none; b=XSfnxYSoSTd8fy/jfxB9XwC56HXiXiTqP9GDGeepUe2eRrsm8ydLbJLsAfwJeyo8BYIkyThiKg5PhxSwvanBq0EoS6o2pGrFdESHJfNOMYTOMMfYuIrN0+jZVLBZWc6vW2tzolcBKXQCRAZh5oBa7TGnhm/HNIuX0dmFk0lYJm0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703274168; c=relaxed/simple; bh=l104geE3tVDMr4d5zPIxl07CgFZhrEIJPkh1CkbKAf8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=HY89UQGhtkeVTZjRgkce3747+aEk5Pl+6m6/nxzz7p5GAbj+UXLchbRlozcS/Y4FZ/bOMMV7/sx9e0CmgiVKUjmUW6M99E48r5ZAMKwj6FnUE+4TTwHZg12rjOe8ceIWk7Gk6EmJZS5JuuYwMgBqx4lo1UDzD35YsH7x+i4xuvU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-a2331caab22so239292066b.3 for ; Fri, 22 Dec 2023 11:42:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703274165; x=1703878965; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=XOnyIKSYe+vFhpK99aNAa7R99FyzSsPcGqc4tdWJSlM=; b=e5pdDgk15uetXMdygPTe1pNxsUxlD8T5saQOYpCGHQSKkNThHryIc0owxoWlZbNjEt FKS84KJo+sNXfU9buUN8QchiTd8h5ISOMGoP4lSufgjT487fIKBMeOiKPLQXDHXT7KlC Sg9rVTqXmkbb7S/JHa23+v7D0gWg+pOmHExkcvjnK9eexMJMkhNj/x4A9Km4RVhwP5ih sIumWharMMH3HfMEzhu08nCgB6m++0kgr+9zPBBvSSnS8wZ3agdwdZ7ZsYMS73bLCo9Q 2m3flRIlpAnKnbjN26TiNON2dzIei616VWwPF0Or/uRz6j9JqZuHSJSQv4GMhhDLu8jJ Ov0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703274165; x=1703878965; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=XOnyIKSYe+vFhpK99aNAa7R99FyzSsPcGqc4tdWJSlM=; b=VnCtgyMb9KWDCpcGFo+94X3YCBxC9QvpGAF7uHY6RYuq46mWBMBHApSd3do0e8AMsM lHoSlBqUrMi0lxJla9DAsI5K9WPlQ1JV/4QbYDVyFapf9HZBxLVSsvoq4sPhMdFyUkYq hOvT9+vbyx5/KpJNoBMrInnNE48VwRHFMB8JB9M+DPLG38xpbIynolNuToghdBNII9N0 SbmldFQVXypHCMBZnmvC75ydSprfffNgcztUN6NuNNcdVz52UoJNcYtvxSiAttXGM71s 6BiRwdWWSuncyYKg8M78KhiNbmY/hy2CtgwlQ4SDOj50hIIlvaNualjZVtTOj5tDBVe3 6IkQ== X-Gm-Message-State: AOJu0YyFdQn/kTpRyr9aE5Gh2Mw2STQmL6drzfIDhuOZOsFpZ8nRuyKY uGVDlO6jZ85UW8TdloCH4co= X-Google-Smtp-Source: AGHT+IHkOWVliAFoQUl+VJxSHNZFdzqrjhwmaM9xLG1CuMl2BA+zHIT3yPSby02Qk4VD+b4qf3diZw== X-Received: by 2002:a17:907:1587:b0:a23:6414:839f with SMTP id cf7-20020a170907158700b00a236414839fmr882367ejc.82.1703274165230; Fri, 22 Dec 2023 11:42:45 -0800 (PST) Received: from nz.home ([2a00:23c8:a613:101:22b6:f25c:52e9:1507]) by smtp.gmail.com with ESMTPSA id s24-20020a170906169800b00a1f8bae93d3sm2346090ejd.215.2023.12.22.11.42.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 11:42:43 -0800 (PST) Received: by nz.home (Postfix, from userid 1000) id 72B0F1436D33A4; Fri, 22 Dec 2023 19:42:41 +0000 (GMT) From: Sergei Trofimovich To: systemtap@sourceware.org Cc: Sergei Trofimovich Subject: [PATCH] bpf-translate.cxx: fix build against upcoming `gcc-14` (`-Werror=calloc-transposed-args`) Date: Fri, 22 Dec 2023 19:42:38 +0000 Message-ID: <20231222194238.2461516-1-slyich@gmail.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,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: `gcc-14` added a new `-Wcalloc-transposed-args` warning recently. It detected minor infelicity in `calloc()` API usage in `systemtap`: bpf-translate.cxx: In function 'bpf::BPF_Section* bpf::output_probe(BPF_Output&, program&, const std::string&, unsigned int)': bpf-translate.cxx:5044:39: error: 'void* calloc(size_t, size_t)' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Werror=calloc-transposed-args] 5044 | bpf_insn *buf = (bpf_insn*) calloc (sizeof(bpf_insn), ninsns); | ^~~~~~~~~~~~~~~~ bpf-translate.cxx:5044:39: note: earlier argument should specify number of elements, later size of each element --- bpf-translate.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bpf-translate.cxx b/bpf-translate.cxx index 1a9302463..aa8ef65ce 100644 --- a/bpf-translate.cxx +++ b/bpf-translate.cxx @@ -5041,9 +5041,9 @@ output_probe(BPF_Output &eo, program &prog, } } - bpf_insn *buf = (bpf_insn*) calloc (sizeof(bpf_insn), ninsns); + bpf_insn *buf = (bpf_insn*) calloc (ninsns, sizeof(bpf_insn)); assert (buf); - Elf64_Rel *rel = (Elf64_Rel*) calloc (sizeof(Elf64_Rel), nreloc); + Elf64_Rel *rel = (Elf64_Rel*) calloc (nreloc, sizeof(Elf64_Rel)); assert (rel); unsigned i = 0, r = 0; -- 2.42.0