svn commit: r238828 - head/sys/sys

Gleb Smirnoff glebius at FreeBSD.org
Fri Jul 27 09:16:49 UTC 2012


Author: glebius
Date: Fri Jul 27 09:16:48 2012
New Revision: 238828
URL: http://svn.freebsd.org/changeset/base/238828

Log:
  Add assertion for refcount overflow.
  
  Submitted by:	Andrey Zonov <andrey zonov.org>
  Reviewed by:	kib

Modified:
  head/sys/sys/refcount.h

Modified: head/sys/sys/refcount.h
==============================================================================
--- head/sys/sys/refcount.h	Fri Jul 27 08:28:44 2012	(r238827)
+++ head/sys/sys/refcount.h	Fri Jul 27 09:16:48 2012	(r238828)
@@ -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);	
 }
 


More information about the svn-src-all mailing list