git: 21d29c519221 - main - cred: make the refcount signed
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 29 Mar 2023 05:04:21 UTC
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