Skip to content

Commit 2402725

Browse files
committed
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 <[email protected]>
1 parent 5e7fe8a commit 2402725

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

shallow.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ static uint32_t *paint_alloc(struct paint_info *info)
534534
unsigned nr = DIV_ROUND_UP(info->nr_bits, 32);
535535
unsigned size = nr * sizeof(uint32_t);
536536
void *p;
537-
if (!info->pool_count || size > info->end - info->free) {
537+
if (!info->pool_count || info->end < info->free + size) {
538538
if (size > POOL_SIZE)
539539
BUG("pool size too small for %d in paint_alloc()",
540540
size);

0 commit comments

Comments
 (0)