aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzabolcs Nagy <szabolcs.nagy@arm.com>2022-03-15 09:54:59 +0000
committerSzabolcs Nagy <szabolcs.nagy@arm.com>2022-08-05 19:45:19 +0100
commit4064e7a4fc027aef0f023dc93fe436a512b1aaf9 (patch)
tree9f6b6caf6a00be5f2aba811c9a8c329e79f53dac
parentb3d26f52f7084c1f008b3c746c01db4f122f7879 (diff)
downloadglibc-4064e7a4fc027aef0f023dc93fe436a512b1aaf9.tar
glibc-4064e7a4fc027aef0f023dc93fe436a512b1aaf9.tar.gz
glibc-4064e7a4fc027aef0f023dc93fe436a512b1aaf9.tar.bz2
glibc-4064e7a4fc027aef0f023dc93fe436a512b1aaf9.zip
cheri: malloc: align up without breaking capability in memalign
-rw-r--r--malloc/malloc.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 062ca0dc0a..02df29d2ad 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -4982,8 +4982,7 @@ _int_memalign (mstate av, size_t alignment, size_t bytes)
we can move to the next aligned spot -- we've allocated enough
total room so that this is always possible.
*/
- brk = (char *) mem2chunk (((unsigned long) (m + alignment - 1)) &
- - ((signed long) alignment));
+ brk = (char *) mem2chunk (m + alignment - ((unsigned long) (m) % alignment));
if ((unsigned long) (brk - (char *) (p)) < MINSIZE)
brk += alignment;