Date: Fri, 17 Jan 2014 16:17:08 +0000 (UTC) From: Kirk McKusick <mckusick@FreeBSD.org> 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 Message-ID: <201401171617.s0HGH8R3061024@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201401171617.s0HGH8R3061024>