From c94e37f5fc76c2cae1388a2129ae413fe952c558 Mon Sep 17 00:00:00 2001 From: Nathaniel Filardo Date: Wed, 31 Mar 2021 23:44:03 +0100 Subject: [PATCH] alloc: pass rsize, not size, down to Mediumslab::alloc When we get to CHERI, sizes derived from sizeclasses are always precisely representable, while other sizes may not be. This should induce no change in behavior without CHERI, except that we might PAL::zero slightly more memory this way. --- src/mem/alloc.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mem/alloc.h b/src/mem/alloc.h index 55e3a33..23680f2 100644 --- a/src/mem/alloc.h +++ b/src/mem/alloc.h @@ -1289,8 +1289,8 @@ namespace snmalloc if (slab != nullptr) { - p = - Mediumslab::alloc(slab, size); + p = Mediumslab::alloc( + slab, rsize); if (Mediumslab::full(slab)) sc->pop(); @@ -1312,8 +1312,8 @@ namespace snmalloc Mediumslab::init(slab, public_state(), sizeclass, rsize); chunkmap().set_slab(slab); - p = - Mediumslab::alloc(slab, size); + p = Mediumslab::alloc( + slab, rsize); if (!Mediumslab::full(slab)) sc->insert(slab);