mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-23 11:18:54 +00:00
Properly handle unsigned comparison.
MFC after: 2 weeks
This commit is contained in:
parent
443b507745
commit
9cd7cb1bf1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=260079
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user