From nobody Fri Jul 19 17:07:41 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WQbhY6r9Lz5Rygx; Fri, 19 Jul 2024 17:07:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WQbhY5dlyz58yn; Fri, 19 Jul 2024 17:07:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721408861; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=F7ZH/srApOwo4hSPiJ87MpKTbc/LH1orL4W7OoQZ1UI=; b=YPYSNOCLUQEoIWak+24xRmdazp82VlYYfmtZ5uGaSa9XKzXLAIsBgzLHUOnpwnF7fNRney H9wV877gl1nENCisLsDhSfbGNrSPcwp/6Nk7fljcdh35xTT7922dgLO9hBB7mYOEpKbcWa 01cRU2ybBGl/Yg6ZzDL2zL1kPk7dPgLbwi1Pz0tujx6uMVN7eop6tVxrb3tGnXaN8Lhqqe mUkuspColrKjMIczhZiD6XKhcY6lftW2JXbBL1xM+rVZO83JE7/vPRvO5dfZOUiDnH+KCP k+/L3zghIBXUJPijCqkGaSLrbiURIk1q96DeMcseVSueSO+5gbsbJUH7B+z3Mg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1721408861; a=rsa-sha256; cv=none; b=pU/gu7mW12uQOzOTmhHLdnTdB1QnFpNDjX9lXhfOoCuDpWNHnlvTS+b5uiqMyX8fAjQcMd EmBA2AeA0LxKfro5V9EBUQ6W7QpDqrQzP5lNPrXXsiY0l4Tpi0ttuoTwKSGFEpOqcaeMZM aYOFKqegZAWlzCMJErZmpJ6HNvGD83j6i1QoayN+EML4h5a/5qi6Uy52GjUCGVJleS9a08 xkmifoWFzGEy1DF0EShy8nZ2yq8H40XDH7vV5lP1SeM23NQoUAEiTNFJqvTznFfhGRHKlz 0vwozwCj3IWDHidAttZBDKDCPl+Vduh9ipaBsSJvOTtMGAYslHOQz24Mdkkfnw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721408861; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=F7ZH/srApOwo4hSPiJ87MpKTbc/LH1orL4W7OoQZ1UI=; b=Jye0z3waQCun7zvknGFKizt2ZoBm4r575JnVrxEDMCfKRzcKWdWXofwpVxFuYwEGdPtC9h 7wwiLe0Lafe6lZqvxieXxIcn9mSjL5Q6H1Eq/S9OxfYQa7RTiIWeHfwZvRg/6n1g2BlAxf BGYMEJwBmdCTvJAk3zo2UUzpoOdAx2fwqIj9AWTjctuDjtezQb5ufUi07OWr2FS5Ej1lvS LXuiosCm9dMk2tmq9OZHneMuvJYnXkkzDMguPIktxcpINubwTQWlI7ALGDoJdpBEVS/TEz BpKrN432wX2f2wAs/rOzhQdDPoxSQB69JzLnkGrJpAO5HHOO5Dxqfkybzx0Vfg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WQbhY572zzgn4; Fri, 19 Jul 2024 17:07:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46JH7fLs027783; Fri, 19 Jul 2024 17:07:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46JH7f21027780; Fri, 19 Jul 2024 17:07:41 GMT (envelope-from git) Date: Fri, 19 Jul 2024 17:07:41 GMT Message-Id: <202407191707.46JH7f21027780@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 5275d1ddb42d - main - libcasper: Consistently use item count as the first argument to calloc List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5275d1ddb42dc70fb87925e59445059068c08271 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=5275d1ddb42dc70fb87925e59445059068c08271 commit 5275d1ddb42dc70fb87925e59445059068c08271 Author: John Baldwin AuthorDate: 2024-07-19 17:01:40 +0000 Commit: John Baldwin CommitDate: 2024-07-19 17:05:58 +0000 libcasper: 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/D46005 --- lib/libcasper/services/cap_dns/cap_dns.c | 4 ++-- lib/libcasper/services/cap_net/cap_net.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/libcasper/services/cap_dns/cap_dns.c b/lib/libcasper/services/cap_dns/cap_dns.c index 8548715a6978..32cbf973ad45 100644 --- a/lib/libcasper/services/cap_dns/cap_dns.c +++ b/lib/libcasper/services/cap_dns/cap_dns.c @@ -85,7 +85,7 @@ hostent_unpack(const nvlist_t *nvl, struct hostent *hp) hp->h_length = (int)nvlist_get_number(nvl, "length"); nitems = (unsigned int)nvlist_get_number(nvl, "naliases"); - hp->h_aliases = calloc(sizeof(hp->h_aliases[0]), nitems + 1); + hp->h_aliases = calloc(nitems + 1, sizeof(hp->h_aliases[0])); if (hp->h_aliases == NULL) goto fail; for (ii = 0; ii < nitems; ii++) { @@ -99,7 +99,7 @@ hostent_unpack(const nvlist_t *nvl, struct hostent *hp) hp->h_aliases[ii] = NULL; nitems = (unsigned int)nvlist_get_number(nvl, "naddrs"); - hp->h_addr_list = calloc(sizeof(hp->h_addr_list[0]), nitems + 1); + hp->h_addr_list = calloc(nitems + 1, sizeof(hp->h_addr_list[0])); if (hp->h_addr_list == NULL) goto fail; for (ii = 0; ii < nitems; ii++) { diff --git a/lib/libcasper/services/cap_net/cap_net.c b/lib/libcasper/services/cap_net/cap_net.c index a8f039f81843..40d18319ae28 100644 --- a/lib/libcasper/services/cap_net/cap_net.c +++ b/lib/libcasper/services/cap_net/cap_net.c @@ -105,7 +105,7 @@ hostent_unpack(const nvlist_t *nvl, struct hostent *hp) hp->h_length = (int)nvlist_get_number(nvl, "length"); nitems = (unsigned int)nvlist_get_number(nvl, "naliases"); - hp->h_aliases = calloc(sizeof(hp->h_aliases[0]), nitems + 1); + hp->h_aliases = calloc(nitems + 1, sizeof(hp->h_aliases[0])); if (hp->h_aliases == NULL) goto fail; for (ii = 0; ii < nitems; ii++) { @@ -119,7 +119,7 @@ hostent_unpack(const nvlist_t *nvl, struct hostent *hp) hp->h_aliases[ii] = NULL; nitems = (unsigned int)nvlist_get_number(nvl, "naddrs"); - hp->h_addr_list = calloc(sizeof(hp->h_addr_list[0]), nitems + 1); + hp->h_addr_list = calloc(nitems + 1, sizeof(hp->h_addr_list[0])); if (hp->h_addr_list == NULL) goto fail; for (ii = 0; ii < nitems; ii++) {