From nobody Sat Nov 30 16:51:36 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 4Y0x0852vgz5fJRD; Sat, 30 Nov 2024 16:51:36 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y0x0841rNz4p4L; Sat, 30 Nov 2024 16:51:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732985496; 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=eva0uqN4xZfgH7G89A8pmczXuqfCEVIFMLGpr2McjoQ=; b=Zv+hol8iktxs2G9r4TW63Y7as8Pv4eb695BJGvLSZ+kUAt7rPpugEGKusvVGXLr9aDofeO SGtgz3JupuTvhfws99N02Jx5eeCpRO+xtpEclZqufZ+vz8ydrwMgc9sYQ165oULZZ1/Prt oeEs6UvwTbvsJS/BCK3Lef5io8Glk2foPiwOl7N1JZPqY4Ifejdmwefk9xIkuYQMsj3n1s cIG747E8YT6jvZMhlXGKJIIjL0dIFyddVBR0sL/Pphv2JnT/nenqTUdkLw8RXpDcyqCfkX KEnOgtczSzQ4z9aLg3WY1MAE2hIZ+TD8O9FqIkA6BBE2fAZQNt++sPNRdlFtSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732985496; 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=eva0uqN4xZfgH7G89A8pmczXuqfCEVIFMLGpr2McjoQ=; b=HAmYurdKnwTC2pVihj2uqfu5x1ssTq/lRA0E3aOimlb6tCFL8YnN6A2cNwj3Doh7SDvvZW +TRFNi252P93r/aIolJ2IisEBaKzGUXR/dusAm1CB32gLfUSAXw6i8SELlwByylYJgcabN eWlnEmi/8u22+mvngdqljod3qMgCp/iMl20u+g+PENlCTclMoRAH3QNeCFH2shEAjeav4F JoBzpJmXqu+mr2d8YK+gJnHq0J1ipyf6FIdACs0muVpV1EsupwuFiOV4NUrlkwqWjnDq1N RZpkE2JrfN+oCI2V5yJDre7D0WKwCD+nyVqM+FDy1vrkXKha3sXsdK8cJ1aw7w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1732985496; a=rsa-sha256; cv=none; b=mjdulcUqHks+falayj14RdSwfERQH8Ai6V9m1nYtl0QkM5prKdFCr3GmVdDFgtrVhRBFtm IP3Wr3zzrTYJSEr7L+olmfD+9IAl7BLTkB3ho9k5lbummW1EKjCkv0OKanBtze6o2PQ43f o89RJneVnMjHFzMVrmpJwBAdnfjzmTBR3Vp5hMvIuoCniEUPqf0yGT6O4CkchD6BFf6Ifw xm3JyKIHOsh1fZ73dUPZjZsG0uj4yoDbhwo1YMVzH3TE6dlnYiHj1o6S2yGd0sTQT4XLxm GNBpDRFhTUg8oQFNo6KbRcQgpIvZ2EgGgnqYWZOgZrTW67O82qcxB0lUeE+ZDA== 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 4Y0x083fD4zGQV; Sat, 30 Nov 2024 16:51:36 +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 4AUGpaMt050377; Sat, 30 Nov 2024 16:51:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AUGpaqP050374; Sat, 30 Nov 2024 16:51:36 GMT (envelope-from git) Date: Sat, 30 Nov 2024 16:51:36 GMT Message-Id: <202411301651.4AUGpaqP050374@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: a56dc7e6c774 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: a56dc7e6c774e3bfe8afa7f8d9d445ec6450f9df Auto-Submitted: auto-generated The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a56dc7e6c774e3bfe8afa7f8d9d445ec6450f9df commit a56dc7e6c774e3bfe8afa7f8d9d445ec6450f9df Author: John Baldwin AuthorDate: 2024-07-19 17:01:40 +0000 Commit: John Baldwin CommitDate: 2024-11-29 19:25:37 +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 (cherry picked from commit 5275d1ddb42dc70fb87925e59445059068c08271) --- 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 1e552d2dc252..a5223a0ea4a5 100644 --- a/lib/libcasper/services/cap_dns/cap_dns.c +++ b/lib/libcasper/services/cap_dns/cap_dns.c @@ -84,7 +84,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++) { @@ -98,7 +98,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 c29bc36bf64c..62eddd0a80a8 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++) {