[PATCH 5/6] malloc: Remove unnecessary tagging around _mid_memalign

DJ Delorie dj@redhat.com
Tue Mar 23 20:44:11 GMT 2021


Szabolcs Nagy <szabolcs.nagy@arm.com> writes:
> The internal _mid_memalign already returns newly tagged memory.
> (__libc_memalign and posix_memalign already relied on this, this
> patch fixes the other call sites.)

LGTM.
Reviewed-by: DJ Delorie <dj@redhat.com>

>  void *
>  __libc_valloc (size_t bytes)
>  {
> -  void *p;
> -
>    if (__malloc_initialized < 0)
>      ptmalloc_init ();
>  
>    void *address = RETURN_ADDRESS (0);
>    size_t pagesize = GLRO (dl_pagesize);
> -  p = _mid_memalign (pagesize, bytes, address);
> -  return tag_new_usable (p);
> +  return _mid_memalign (pagesize, bytes, address);
>  }
>  
>  void *
>  __libc_pvalloc (size_t bytes)
>  {
> -  void *p;
> -
>    if (__malloc_initialized < 0)
>      ptmalloc_init ();
>  
> @@ -3585,8 +3580,7 @@ __libc_pvalloc (size_t bytes)
>      }
>    rounded_bytes = rounded_bytes & -(pagesize - 1);
>  
> -  p = _mid_memalign (pagesize, rounded_bytes, address);
> -  return tag_new_usable (p);
> +  return _mid_memalign (pagesize, rounded_bytes, address);
>  }



More information about the Libc-alpha mailing list