From owner-svn-src-all@FreeBSD.ORG Fri Jan 17 16:17:08 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 726DCE99; Fri, 17 Jan 2014 16:17:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5CF29122F; Fri, 17 Jan 2014 16:17:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0HGH8gc061025; Fri, 17 Jan 2014 16:17:08 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0HGH8R3061024; Fri, 17 Jan 2014 16:17:08 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201401171617.s0HGH8R3061024@svn.freebsd.org> From: Kirk McKusick Date: Fri, 17 Jan 2014 16:17:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260827 - stable/10/sys/ufs/ufs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 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: Fri, 17 Jan 2014 16:17:08 -0000 Author: mckusick Date: Fri Jan 17 16:17:07 2014 New Revision: 260827 URL: http://svnweb.freebsd.org/changeset/base/260827 Log: MFC of 260079: Properly handle unsigned comparison. Modified: stable/10/sys/ufs/ufs/ufs_quota.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ufs/ufs/ufs_quota.c ============================================================================== --- stable/10/sys/ufs/ufs/ufs_quota.c Fri Jan 17 15:01:50 2014 (r260826) +++ stable/10/sys/ufs/ufs/ufs_quota.c Fri Jan 17 16:17:07 2014 (r260827) @@ -307,7 +307,6 @@ int chkiq(struct inode *ip, int change, struct ucred *cred, int flags) { struct dquot *dq; - ino_t ncurinodes; int i, error, warn, do_check; #ifdef DIAGNOSTIC @@ -322,10 +321,8 @@ chkiq(struct inode *ip, int change, stru continue; DQI_LOCK(dq); DQI_WAIT(dq, PINOD+1, "chkiq1"); - ncurinodes = dq->dq_curinodes + change; - /* XXX: ncurinodes is unsigned */ - if (dq->dq_curinodes != 0 && ncurinodes >= 0) - dq->dq_curinodes = ncurinodes; + if (dq->dq_curinodes >= -change) + dq->dq_curinodes += change; else dq->dq_curinodes = 0; dq->dq_flags &= ~DQ_INODS; @@ -359,11 +356,8 @@ chkiq(struct inode *ip, int change, stru continue; DQI_LOCK(dq); DQI_WAIT(dq, PINOD+1, "chkiq3"); - ncurinodes = dq->dq_curinodes - change; - /* XXX: ncurinodes is unsigned */ - if (dq->dq_curinodes != 0 && - ncurinodes >= 0) - dq->dq_curinodes = ncurinodes; + if (dq->dq_curinodes >= change) + dq->dq_curinodes -= change; else dq->dq_curinodes = 0; dq->dq_flags &= ~DQ_INODS;