sign-compare: avoid comparing ptrdiff with an int/unsigned
Instead, offset the base pointer with integer and compare it with the other pointer. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Dec 27, 2024 at 12:25 UTC
24027256aa9614a445563707a72af7ce5ff49b5b
1 file changed
+1
-1
shallow.c
+1
-1
@@ -534,7 +534,7 @@ static uint32_t *paint_alloc(struct paint_info *info)
534
unsigned nr = DIV_ROUND_UP(info->nr_bits, 32);
535
unsigned size = nr * sizeof(uint32_t);
536
void *p;
537
- if (!info->pool_count || size > info->end - info->free) {
537
+ if (!info->pool_count || info->end < info->free + size) {
538
if (size > POOL_SIZE)
539
BUG("pool size too small for %d in paint_alloc()",
540
size);