Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Feb 2025 17:51:36 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 749ec2967ed3 - stable/13 - pac: Consistently use item count as the first argument to calloc
Message-ID:  <202502131751.51DHpaGE069411@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=749ec2967ed3e157d6cd6cbe85b0ae953ae114c6

commit 749ec2967ed3e157d6cd6cbe85b0ae953ae114c6
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-01-03 15:41:36 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-02-13 17:49:06 +0000

    pac: Consistently use item count as the first argument to calloc
    
    Reported by:    GCC 14 -Wcalloc-transposed-args
    
    (cherry picked from commit 22956bc9dc907296196a37525a6726f6ba2c06ed)
---
 usr.sbin/lpr/pac/pac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr.sbin/lpr/pac/pac.c b/usr.sbin/lpr/pac/pac.c
index 5eb5cab02353..d79b84c4ab9b 100644
--- a/usr.sbin/lpr/pac/pac.c
+++ b/usr.sbin/lpr/pac/pac.c
@@ -260,7 +260,7 @@ dumpit(void)
 
 	hp = hashtab[0];
 	hno = 1;
-	base = (struct hent **) calloc(sizeof hp, hcount);
+	base = (struct hent **) calloc(hcount, sizeof(hp));
 	for (ap = base, c = hcount; c--; ap++) {
 		while (hp == NULL)
 			hp = hashtab[hno++];
@@ -338,7 +338,7 @@ enter(const char name[])
 		return(hp);
 	h = hash(name);
 	hcount++;
-	hp = (struct hent *) calloc(sizeof *hp, (size_t)1);
+	hp = (struct hent *) calloc(1, sizeof(*hp));
 	hp->h_name = strdup(name);
 	hp->h_feetpages = 0.0;
 	hp->h_count = 0;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202502131751.51DHpaGE069411>