From 4c6be9cb63ff66ce49a6f733c1e00d1889f2c95f Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sun, 10 Apr 2022 20:37:51 +0300 Subject: add basic ubsan and fix issues reported by it --- common/pmem.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'common/pmem.c') diff --git a/common/pmem.c b/common/pmem.c index 6ef89bc..e3e5e5c 100644 --- a/common/pmem.c +++ b/common/pmem.c @@ -236,6 +236,7 @@ static pm_t __populate_order(mm_node_t **op, pm_t cont, enum mm_order src, o->entries = num; o->full = (mm_info_t *)move_forward(cont, state_elems(num)); + cont = align_up(cont, sizeof(void *)); o->next = (mm_node_t **)move_forward(cont, next_elems(num)); memset(o->full, 0, state_elems(num)); memset(o->next, 0, next_elems(num)); @@ -260,6 +261,7 @@ static pm_t __probe_order(pm_t cont, enum mm_order src, enum mm_order dst, cont += sizeof(struct mm_branch_t); cont += state_elems(num); + cont = align_up(cont, sizeof(void *)); cont += next_elems(num); for (size_t i = 0; i < num; ++i) -- cgit v1.3