From 5da96a77a84ae5414debbc46d390464d51010113 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Thu, 12 Jul 2018 01:45:13 -0700 Subject: session: make sure segment sizes are page aligned Change-Id: Ibbba75d069ca1bbf9e5a1b8bd2f405d32021c656 Signed-off-by: Florin Coras --- src/svm/ssvm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/svm') diff --git a/src/svm/ssvm.c b/src/svm/ssvm.c index dfb68c039ad..c005b61144b 100644 --- a/src/svm/ssvm.c +++ b/src/svm/ssvm.c @@ -331,10 +331,11 @@ ssvm_master_init_private (ssvm_private_t * ssvm) u32 pagesize = clib_mem_get_page_size (); ssvm_shared_header_t *sh; mheap_t *heap_header; - u32 rnd_size = 0; + u64 rnd_size = 0; u8 *heap; - rnd_size = (ssvm->ssvm_size + (pagesize - 1)) & ~pagesize; + rnd_size = (ssvm->ssvm_size + (pagesize - 1)) & ~(pagesize - 1); + rnd_size = clib_min (rnd_size, ((u64) 1 << 32) - pagesize); heap = mheap_alloc (0, rnd_size); if (heap == 0) { -- cgit 1.2.3-korg