aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/svm/fifo_segment.c19
-rw-r--r--src/svm/ssvm.c1
-rw-r--r--src/vnet/session/application.c2
-rw-r--r--src/vnet/session/segment_manager.c4
4 files changed, 7 insertions, 19 deletions
diff --git a/src/svm/fifo_segment.c b/src/svm/fifo_segment.c
index 758b2648ece..fdbc8102587 100644
--- a/src/svm/fifo_segment.c
+++ b/src/svm/fifo_segment.c
@@ -190,23 +190,8 @@ fifo_segment_get_segment (fifo_segment_main_t * sm, u32 segment_index)
void
fifo_segment_info (fifo_segment_t * seg, char **address, size_t * size)
{
- if (ssvm_type (&seg->ssvm) == SSVM_SEGMENT_PRIVATE)
- {
-#if USE_DLMALLOC == 0
- mheap_t *heap_header;
-
- *address = pointer_to_uword (seg->ssvm.sh->heap);
- heap_header = mheap_header (seg->ssvm.sh->heap);
- *size = heap_header->max_size;
-#else
- mspace_get_address_and_size (seg->ssvm.sh->heap, address, size);
-#endif
- }
- else
- {
- *address = (char *) seg->ssvm.sh->ssvm_va;
- *size = seg->ssvm.ssvm_size;
- }
+ *address = (char *) seg->ssvm.sh->ssvm_va;
+ *size = seg->ssvm.ssvm_size;
}
void
diff --git a/src/svm/ssvm.c b/src/svm/ssvm.c
index 59a5d228957..3e45175da0e 100644
--- a/src/svm/ssvm.c
+++ b/src/svm/ssvm.c
@@ -383,6 +383,7 @@ ssvm_master_init_private (ssvm_private_t * ssvm)
clib_memset (sh, 0, sizeof (*sh));
sh->heap = heap;
+ sh->ssvm_va = pointer_to_uword (heap);
sh->type = SSVM_SEGMENT_PRIVATE;
return 0;
diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c
index 69cc87c9575..4bae8dba4de 100644
--- a/src/vnet/session/application.c
+++ b/src/vnet/session/application.c
@@ -554,7 +554,7 @@ application_alloc_and_init (app_init_args_t * a)
props = application_segment_manager_properties (app);
segment_manager_props_init (props);
- props->segment_size = options[APP_OPTIONS_ADD_SEGMENT_SIZE];
+ props->segment_size = options[APP_OPTIONS_SEGMENT_SIZE];
props->prealloc_fifos = options[APP_OPTIONS_PREALLOC_FIFO_PAIRS];
if (options[APP_OPTIONS_ADD_SEGMENT_SIZE])
{
diff --git a/src/vnet/session/segment_manager.c b/src/vnet/session/segment_manager.c
index 6213cd517f6..cbec493e55f 100644
--- a/src/vnet/session/segment_manager.c
+++ b/src/vnet/session/segment_manager.c
@@ -114,7 +114,9 @@ segment_manager_add_segment (segment_manager_t * sm, u32 segment_size)
*/
segment_size = segment_size ? segment_size : props->add_segment_size;
page_size = clib_mem_get_page_size ();
- segment_size = (segment_size + page_size - 1) & ~(page_size - 1);
+ /* Protect against segment size u32 wrap */
+ segment_size = clib_max (segment_size + page_size - 1, segment_size);
+ segment_size = segment_size & ~(page_size - 1);
if (props->segment_type != SSVM_SEGMENT_PRIVATE)
{
seg_name = format (0, "%d-%d%c", getpid (), smm->seg_name_counter++, 0);