From d840d7852b10121003e2af82f3463eb1705d4469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 26 Dec 2019 22:27:25 +0100 Subject: [PATCH] ntdll: Rename find_free_area to find_reserved_free_area. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We used this function to find free areas outside of the reserved range, and it's obviously incorrect as there can be some system or external memory mapping we don't know about. Signed-off-by: RĂ©mi Bernon Signed-off-by: Alexandre Julliard --- dlls/ntdll/virtual.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c index cb869feff02..ded00e3eb7d 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -496,14 +496,14 @@ static struct file_view *find_view_range( const void *addr, size_t size ) return NULL; } - /*********************************************************************** - * find_free_area + * find_reserved_free_area * * Find a free area between views inside the specified range. * The csVirtual section must be held by caller. + * The range must be inside the preloader reserved range. */ -static void *find_free_area( void *base, void *end, size_t size, size_t mask, int top_down ) +static void *find_reserved_free_area( void *base, void *end, size_t size, size_t mask, int top_down ) { struct wine_rb_entry *first = NULL, *ptr = views_tree.root; void *start; @@ -1053,14 +1053,14 @@ static int alloc_reserved_area_callback( void *start, size_t size, void *arg ) else { /* range is split in two by the preloader reservation, try first part */ - if ((alloc->result = find_free_area( start, preload_reserve_start, alloc->size, - alloc->mask, alloc->top_down ))) + if ((alloc->result = find_reserved_free_area( start, preload_reserve_start, alloc->size, + alloc->mask, alloc->top_down ))) return 1; /* then fall through to try second part */ start = preload_reserve_end; } } - if ((alloc->result = find_free_area( start, end, alloc->size, alloc->mask, alloc->top_down ))) + if ((alloc->result = find_reserved_free_area( start, end, alloc->size, alloc->mask, alloc->top_down ))) return 1; return 0; @@ -1167,7 +1167,7 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size, { if (!zero_bits_64) ptr = NULL; - else if (!(ptr = find_free_area( (void*)0, alloc.limit, view_size, mask, top_down ))) + else if (!(ptr = find_reserved_free_area( (void*)0, alloc.limit, view_size, mask, top_down ))) return STATUS_NO_MEMORY; if ((ptr = wine_anon_mmap( ptr, view_size, VIRTUAL_GetUnixProt(vprot), ptr ? MAP_FIXED : 0 )) == (void *)-1)