summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2017-12-13 13:51:13 +0100
committerFlorin Coras <florin.coras@gmail.com>2017-12-13 16:25:29 +0000
commit52014c674e6e52ea48682aa2eea8db23c6b8c252 (patch)
treec1baed6876c796c9186a25d437eb8a7dccf960a6
parent1ec3652c25c593a7dcaae293b2f7dbed6eb15963 (diff)
physmem: fix bug in detection of cross page boundary allocations
Change-Id: I18e9227565243bce7d4102b1950eec9e019a097a Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r--src/vlib/linux/physmem.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/vlib/linux/physmem.c b/src/vlib/linux/physmem.c
index b5f84ecc8a4..161dbf5c0c7 100644
--- a/src/vlib/linux/physmem.c
+++ b/src/vlib/linux/physmem.c
@@ -85,8 +85,8 @@ unix_physmem_alloc_aligned (vlib_main_t * vm, vlib_physmem_region_index_t idx,
/* Make sure allocation does not span DMA physical chunk boundary. */
hi_offset = lo_offset + n_bytes - 1;
- if ((lo_offset >> pr->log2_page_size) ==
- (hi_offset >> pr->log2_page_size))
+ if (((pointer_to_uword (pr->heap) + lo_offset) >> pr->log2_page_size) ==
+ ((pointer_to_uword (pr->heap) + hi_offset) >> pr->log2_page_size))
break;
/* Allocation would span chunk boundary, queue it to be freed as soon as