summaryrefslogtreecommitdiff
path: root/libpager
diff options
context:
space:
mode:
authorEtienne Brateau <etienne.brateau@gmail.com>2022-01-19 20:29:40 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2022-01-20 00:29:43 +0100
commit6fd9cd1599381115ca57786c4412e4501dda1748 (patch)
tree2cf098523f880f1ed7849073be6ac79356e6a8e7 /libpager
parent996448841d7714f6404a6e2173eaa06f9b64ad5f (diff)
libpager: fix assertion unsigned against 0
Comparing an unsigned to be superior or equals to 0 is always true, instead move the assert before the substraction and compare it to the value to substract. Message-Id: <20220119192945.36654-2-etienne.brateau@gmail.com>
Diffstat (limited to 'libpager')
-rw-r--r--libpager/pager-memcpy.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libpager/pager-memcpy.c b/libpager/pager-memcpy.c
index 12515933..5a5aac2a 100644
--- a/libpager/pager-memcpy.c
+++ b/libpager/pager-memcpy.c
@@ -130,13 +130,13 @@ pager_memcpy (struct pager *pager, memory_object_t memobj,
vm_deallocate (mach_task_self (), window, window_size);
+ assert_backtrace (n >= copy_count);
+ assert_backtrace (to_copy >= copy_count);
+
offset += copy_count;
other += copy_count;
to_copy -= copy_count;
n -= copy_count;
-
- assert_backtrace (n >= 0);
- assert_backtrace (to_copy >= 0);
}
while (to_copy > 0);