diff options
author | mckusick <mckusick@FreeBSD.org> | 2013-12-30 06:19:42 +0000 |
---|---|---|
committer | mckusick <mckusick@FreeBSD.org> | 2013-12-30 06:19:42 +0000 |
commit | 34936e35bb50fd4c23a3f80e39220bc499bd5231 (patch) | |
tree | 3ae298a8f442f11a5ce8820d30211a1e8526cf96 /sys/ufs/ufs | |
parent | 546591d27bb88e31b213392a3ac0e021e8d39944 (diff) | |
download | FreeBSD-src-34936e35bb50fd4c23a3f80e39220bc499bd5231.zip FreeBSD-src-34936e35bb50fd4c23a3f80e39220bc499bd5231.tar.gz |
Properly handle unsigned comparison.
MFC after: 2 weeks
Diffstat (limited to 'sys/ufs/ufs')
-rw-r--r-- | sys/ufs/ufs/ufs_quota.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/sys/ufs/ufs/ufs_quota.c b/sys/ufs/ufs/ufs_quota.c index a949898..f8bc981 100644 --- a/sys/ufs/ufs/ufs_quota.c +++ b/sys/ufs/ufs/ufs_quota.c @@ -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, struct ucred *cred, int flags) 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, struct ucred *cred, int flags) 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; |