mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-21 11:13:30 +00:00
Add assertion for refcount overflow.
Submitted by: Andrey Zonov <andrey zonov.org> Reviewed by: kib
This commit is contained in:
parent
48cbf1ba5b
commit
be6ab406bd
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=238828
@ -32,6 +32,7 @@
|
||||
#ifndef __SYS_REFCOUNT_H__
|
||||
#define __SYS_REFCOUNT_H__
|
||||
|
||||
#include <sys/limits.h>
|
||||
#include <machine/atomic.h>
|
||||
|
||||
#ifdef _KERNEL
|
||||
@ -51,6 +52,7 @@ static __inline void
|
||||
refcount_acquire(volatile u_int *count)
|
||||
{
|
||||
|
||||
KASSERT(*count < UINT_MAX, ("refcount %p overflowed", count));
|
||||
atomic_add_acq_int(count, 1);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user