mirror of
https://github.com/opnsense/src.git
synced 2026-06-11 09:41:03 -04:00
Properly handle unsigned comparison.
MFC after: 2 weeks
This commit is contained in:
parent
443b507745
commit
9cd7cb1bf1
1 changed files with 4 additions and 10 deletions
|
|
@ -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 a new issue