summaryrefslogtreecommitdiff
path: root/lib/slab.c
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2022-02-07 04:39:49 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2022-02-07 04:39:49 +0100
commitedc1a2401752c3db30df1b9c6c796c06a8c59cc1 (patch)
tree446bb450a386a56028f6f8c459097ba628ef56be /lib/slab.c
parent53a25406878ed686a58ec3e7379d6cb45b784942 (diff)
Lib: Update alignment of slabs
Alignment of slabs should be at least sizeof(ptr) to avoid unaligned pointers in slab structures. Fixme: Use proper way to choose alignment for internal allocators.
Diffstat (limited to 'lib/slab.c')
-rw-r--r--lib/slab.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/slab.c b/lib/slab.c
index 6cab6b7b..1d844bab 100644
--- a/lib/slab.c
+++ b/lib/slab.c
@@ -195,8 +195,8 @@ sl_new(pool *p, uint size)
{
slab *s = ralloc(p, &sl_class);
uint align = sizeof(struct sl_alignment);
- if (align < sizeof(int))
- align = sizeof(int);
+ if (align < sizeof(void *))
+ align = sizeof(void *);
s->data_size = size;
size = (size + align - 1) / align * align;
s->obj_size = size;