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.
_______________________________________________
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