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);   
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to