Deducting negative number from unsigned integer causes
signed integer conversion to unsigned int, which results a
too large positive number. Do calculations using int64 instead.
This did not cause any visible problems, found by
clang integer sanitization.
if (ctx->bytes_used > 0 && bytes_current < (uint64_t)ctx->bytes_used)
bytes_before = 0;
else
- bytes_before = bytes_current - ctx->bytes_used;
+ bytes_before = (int64_t)bytes_current - ctx->bytes_used;
if (ctx->count_used > 0 && count_current < (uint64_t)ctx->count_used)
count_before = 0;
else
- count_before = count_current - ctx->count_used;
+ count_before = (int64_t)count_current - ctx->count_used;
for (i = 0; i < count; i++) {
if (quota_warning_match(&warnings[i],
bytes_before, bytes_current,