From 539ef7c462852cf9b528e9d7b8fc6999ed8d5f2d Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sun, 11 Sep 2022 17:58:45 -0500 Subject: [PATCH] ntdll: Avoid comparing the result of pointer arithmetic to zero. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit gcc warns about this: ../wine/dlls/ntdll/unix/virtual.c: In function ‘mmap_add_reserved_area’: ../wine/dlls/ntdll/unix/virtual.c:241:9: error: the comparison will always evaluate as ‘true’ for the pointer operand in ‘(char *)addr + (sizetype)size’ must not be NULL [-Werror=address] 241 | if (!((char *)addr + size)) size--; /* avoid wrap-around */ | ^ --- dlls/ntdll/unix/virtual.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 96a5e095d16..e0aa410373e 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -238,7 +238,7 @@ static void mmap_add_reserved_area( void *addr, SIZE_T size ) struct reserved_area *area; struct list *ptr; - if (!((char *)addr + size)) size--; /* avoid wrap-around */ + if (!((intptr_t)addr + size)) size--; /* avoid wrap-around */ LIST_FOR_EACH( ptr, &reserved_areas ) { @@ -287,7 +287,7 @@ static void mmap_remove_reserved_area( void *addr, SIZE_T size ) struct reserved_area *area; struct list *ptr; - if (!((char *)addr + size)) size--; /* avoid wrap-around */ + if (!((intptr_t)addr + size)) size--; /* avoid wrap-around */ ptr = list_head( &reserved_areas ); /* find the first area covering address */ -- 2.11.4.GIT