Module: wine Branch: oldstable Commit: b480fb86953a4f397e2b850d1839fe4411ce6b82 URL: https://gitlab.winehq.org/wine/wine/-/commit/b480fb86953a4f397e2b850d1839fe4...
Author: Zebediah Figura zfigura@codeweavers.com Date: Thu Sep 15 23:15:30 2022 -0500
libwine: Avoid comparing the result of pointer arithmetic to zero.
gcc warns about this:
../wine/libs/wine/mmap.c: In function ‘wine_mmap_add_reserved_area_obsolete’: ../wine/libs/wine/mmap.c:504:9: error: the comparison will always evaluate as ‘true’ for the pointer operand in ‘(char *)addr + (sizetype)size’ must not be NULL [-Werror=address] 504 | if (!((char *)addr + size)) size--; /* avoid wrap-around */ | ^
(cherry picked from commit d17fe0a7920c09a16e75b74213ae0e8bbbd1cba0) Signed-off-by: Michael Stefaniuc mstefani@winehq.org
---
libs/wine/mmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libs/wine/mmap.c b/libs/wine/mmap.c index ad51153d039..1f8ae3c7720 100644 --- a/libs/wine/mmap.c +++ b/libs/wine/mmap.c @@ -501,7 +501,7 @@ void wine_mmap_add_reserved_area_obsolete( 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 ) { @@ -560,7 +560,7 @@ void wine_mmap_remove_reserved_area_obsolete( void *addr, size_t size, int unmap 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 */