From owner-svn-src-all@FreeBSD.ORG Thu Jun 17 10:15:14 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1266F1065674; Thu, 17 Jun 2010 10:15:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 01E2F8FC1B; Thu, 17 Jun 2010 10:15:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5HAFD8C091111; Thu, 17 Jun 2010 10:15:13 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5HAFDaU091109; Thu, 17 Jun 2010 10:15:13 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201006171015.o5HAFDaU091109@svn.freebsd.org> From: Andriy Gapon Date: Thu, 17 Jun 2010 10:15:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209247 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jun 2010 10:15:14 -0000 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.