Date: Mon, 30 Dec 2013 06:19:43 +0000 (UTC) From: Kirk McKusick <mckusick@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260079 - head/sys/ufs/ufs Message-ID: <201312300619.rBU6JhPb074382@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mckusick Date: Mon Dec 30 06:19:42 2013 New Revision: 260079 URL: http://svnweb.freebsd.org/changeset/base/260079 Log: Properly handle unsigned comparison. MFC after: 2 weeks Modified: head/sys/ufs/ufs/ufs_quota.c Modified: head/sys/ufs/ufs/ufs_quota.c ============================================================================== --- head/sys/ufs/ufs/ufs_quota.c Mon Dec 30 05:22:22 2013 (r260078) +++ head/sys/ufs/ufs/ufs_quota.c Mon Dec 30 06:19:42 2013 (r260079) @@ -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?201312300619.rBU6JhPb074382>