diff mbox series

[2/6] malloc: Use different tag after mremap

Message ID 4aadefff0647fd8a4ade4377bdfab60989c37b7f.1616155129.git.szabolcs.nagy@arm.com
State New
Headers show
Series malloc: more memory tagging optimizations | expand

Commit Message

Szabolcs Nagy March 19, 2021, 1:26 p.m. UTC
The comment explained why different tag is used after mremap, but
for that correctly tagged pointer should be passed to tag_new_usable.
Use chunk2mem to get the tag.
---
 malloc/malloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/malloc/malloc.c b/malloc/malloc.c
index 03eb0f40fa..34884808e2 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -3411,7 +3411,7 @@  __libc_realloc (void *oldmem, size_t bytes)
       newp = mremap_chunk (oldp, nb);
       if (newp)
 	{
-	  void *newmem = chunk2rawmem (newp);
+	  void *newmem = chunk2mem (newp);
 	  /* Give the new block a different tag.  This helps to ensure
 	     that stale handles to the previous mapping are not
 	     reused.  There's a performance hit for both us and the