summaryrefslogtreecommitdiffstats
path: root/sys/ufs
diff options
context:
space:
mode:
authormckusick <mckusick@FreeBSD.org>2014-01-17 16:17:07 +0000
committermckusick <mckusick@FreeBSD.org>2014-01-17 16:17:07 +0000
commitf24118828127c4cce4c4d530fd6d4fdbad283517 (patch)
tree8d4e94eba90b1353bb3f1f4f088d69a3d88517a5 /sys/ufs
parentc1dbdbde60b3dce381c43d96c9f234e354d4e721 (diff)
downloadFreeBSD-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.c14
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;
OpenPOWER on IntegriCloud