diff options
author | mckusick <mckusick@FreeBSD.org> | 2014-01-17 16:17:07 +0000 |
---|---|---|
committer | mckusick <mckusick@FreeBSD.org> | 2014-01-17 16:17:07 +0000 |
commit | f24118828127c4cce4c4d530fd6d4fdbad283517 (patch) | |
tree | 8d4e94eba90b1353bb3f1f4f088d69a3d88517a5 /sys/ufs | |
parent | c1dbdbde60b3dce381c43d96c9f234e354d4e721 (diff) | |
download | FreeBSD-src-f24118828127c4cce4c4d530fd6d4fdbad283517.zip FreeBSD-src-f24118828127c4cce4c4d530fd6d4fdbad283517.tar.gz |
MFC of 260079:
Properly handle unsigned comparison.
Diffstat (limited to 'sys/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; |