Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Mar 2023 05:04:21 GMT
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 21d29c519221 - main - cred: make the refcount signed
Message-ID:  <202303290504.32T54LtN074306@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by mjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=21d29c51922141ff26a4d0e47efe6b551eb03e0e

commit 21d29c51922141ff26a4d0e47efe6b551eb03e0e
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2023-03-22 21:44:55 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2023-03-29 05:02:04 +0000

    cred: make the refcount signed
    
    There are asserts on the count being > 0, but they are less useful than
    they can be because the type itself is unsigned.
    
    The kernel is compiled with -frapv, making wraparound perfectly defined.
    
    Differential Revision:  https://reviews.freebsd.org/D39220
---
 sys/sys/ucred.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/sys/ucred.h b/sys/sys/ucred.h
index 6a9becb54c75..5ec54be70c2e 100644
--- a/sys/sys/ucred.h
+++ b/sys/sys/ucred.h
@@ -61,7 +61,7 @@ struct loginclass;
 #if defined(_KERNEL) || defined(_WANT_UCRED)
 struct ucred {
 	struct mtx cr_mtx;
-	u_int	cr_ref;			/* (c) reference count */
+	int	cr_ref;			/* (c) reference count */
 	u_int	cr_users;		/* (c) proc + thread using this cred */
 	struct auditinfo_addr	cr_audit;	/* Audit properties. */
 #define	cr_startcopy cr_uid



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