aboutsummaryrefslogtreecommitdiffstats
path: root/lib/librte_eal/common/malloc_elem.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/librte_eal/common/malloc_elem.c')
-rw-r--r--lib/librte_eal/common/malloc_elem.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/librte_eal/common/malloc_elem.c b/lib/librte_eal/common/malloc_elem.c
index 9d3dcb6a..052aeeb7 100644
--- a/lib/librte_eal/common/malloc_elem.c
+++ b/lib/librte_eal/common/malloc_elem.c
@@ -38,6 +38,10 @@ malloc_elem_find_max_iova_contig(struct malloc_elem *elem, size_t align)
/* segment must start after header and with specified alignment */
contig_seg_start = RTE_PTR_ALIGN_CEIL(data_start, align);
+ /* return if aligned address is already out of malloc element */
+ if (contig_seg_start > data_end)
+ return 0;
+
/* if we're in IOVA as VA mode, or if we're in legacy mode with
* hugepages, all elements are IOVA-contiguous. however, we can only
* make these assumptions about internal memory - externally allocated