Date: Fri, 27 Jul 2012 09:16:48 +0000 (UTC) From: Gleb Smirnoff <glebius@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r238828 - head/sys/sys Message-ID: <201207270916.q6R9Gm23086648@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201207270916.q6R9Gm23086648>