From nobody Sat Nov 30 16:51:14 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 4Y0wzk316Sz5fHrp; Sat, 30 Nov 2024 16:51:14 +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 4Y0wzk29xQz4nT7; Sat, 30 Nov 2024 16:51:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732985474; 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=ts/Ao/oNy9uLt1TICMt/e0xrK+haPXvFq8KYFDBG9L4=; b=EsDEne0MfGtHy037nBpP6cdi0VcB9a9VWcux0TTIh46I9I7ZFxPbG6S2bpuMLZeC7EbSEr XT/NHcrrL0Jc7wxRW8gFoFxGYAU+NUpJij1bZxpBl3F2QdoQB7xTUvMuRRb2zsNh3oCaYR +COsvxdaQiDAjdk/0MENT10GBzSiw5znh5xvo0R7+62b6dkeGgy34spee4OjMEAfSN41Xp BeGUWf175M9myPtcYURRtVb8DB1EwynIe8DXR9wJhNSLqLH4iUlR8zCCPoZ0xHZndMmueA Nu1fxjsd0uMmQpnZka/uLDxrYTk/X5o9kobH3W9583ZOUVN8qH1rWVMgUilafg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732985474; 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=ts/Ao/oNy9uLt1TICMt/e0xrK+haPXvFq8KYFDBG9L4=; b=gijGdDBu34I3R3S+QRXLpD8tCTm7zgpDWQ/GgVzomciQWS7BbCk+JhfvCCIvN/Fdg3Ms4Z qsSOSPBJ8QGxnWTpH7iyxVCCSV1cQmJPNI3p1SWBY+tuLAFxjiE2JO0ylH9iCDFPqJUBC4 TxpaQW+QVJ0aGaUhL7KShE3F8l4gUx2UuBx2q88fw+26AQXtgHq5xUXxhbIG3nmo20X/Ga Mr/FYL5ZIynmls4LKvmcIs9xas/JTqEUOrwhMQMtS9FLYF4X2kCahou0WlUUtMoattEERc B28634Ka+QKF03lOTi6ejkr85Te90ShOx12VOxak7oCj+fC+NAzqcvwF1+5/TQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1732985474; a=rsa-sha256; cv=none; b=TnpyJ6YyO+avQPh0OuM5sOkpgLT4Mq/dK7COhL/BSxCNhP0lNJBQhef5YLU5YQpo4z3SLb 0dHWjijeVQI2FjFhV17RK5CNxSpF7axLkaKLLvxT9a1BJS+3a3m1KQ1u0BJ/kzvbApWbzS zi9D4Qv6LMO96q0ixT3rnucWkdk4WZUd6O1XqSfSZyv7Vv6Ey7bqtleW3Fbqt2RQu85KrI Z0sXhtn6KSDJ5ZKef9Gf7H3JBE9xa6B97xU4U9H+YkaAdWbMtJ3QRWO5c4YGALC1Jy1Q1Y xkmYuLtl15SokbaFqYo/89RPPeyTzWilKWqfCw4LIfQrIgO1IglNqbldUwQQ8w== 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 4Y0wzk1VV5zFxc; Sat, 30 Nov 2024 16:51:14 +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 4AUGpE9g043596; Sat, 30 Nov 2024 16:51:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AUGpEYd043593; Sat, 30 Nov 2024 16:51:14 GMT (envelope-from git) Date: Sat, 30 Nov 2024 16:51:14 GMT Message-Id: <202411301651.4AUGpEYd043593@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: 27c7ae36be0f - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: 27c7ae36be0f2e9e06701e9cd1b8383a1b125edc Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=27c7ae36be0f2e9e06701e9cd1b8383a1b125edc commit 27c7ae36be0f2e9e06701e9cd1b8383a1b125edc Author: John Baldwin AuthorDate: 2024-07-19 17:01:40 +0000 Commit: John Baldwin CommitDate: 2024-11-30 13:55:57 +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 84b49e1d2081..8681f0baef40 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 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++) {