Date: Thu, 17 Jun 2010 10:15:13 +0000 (UTC) From: Andriy Gapon <avg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r209247 - head/sys/kern Message-ID: <201006171015.o5HAFDaU091109@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: avg Date: Thu Jun 17 10:15:13 2010 New Revision: 209247 URL: http://svn.freebsd.org/changeset/base/209247 Log: lock_profile_release_lock: do not compare unsigned with zero Found by: Coverity Prevent CID: 3660 Reviewed by: jhb MFC after: 2 weeks Modified: head/sys/kern/subr_lock.c Modified: head/sys/kern/subr_lock.c ============================================================================== --- head/sys/kern/subr_lock.c Thu Jun 17 09:43:07 2010 (r209246) +++ head/sys/kern/subr_lock.c Thu Jun 17 10:15:13 2010 (r209247) @@ -598,7 +598,7 @@ lock_profile_release_lock(struct lock_ob struct lock_profile_object *l; struct lock_prof_type *type; struct lock_prof *lp; - u_int64_t holdtime; + u_int64_t curtime, holdtime; struct lpohead *head; int spin; @@ -626,9 +626,11 @@ lock_profile_release_lock(struct lock_ob lp = lock_profile_lookup(lo, spin, l->lpo_file, l->lpo_line); if (lp == NULL) goto release; - holdtime = nanoseconds() - l->lpo_acqtime; - if (holdtime < 0) + curtime = nanoseconds(); + if (curtime < l->lpo_acqtime) goto release; + holdtime = curtime - l->lpo_acqtime; + /* * Record if the lock has been held longer now than ever * before.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201006171015.o5HAFDaU091109>