aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorHaiyang Tan <haiyangtan@tencent.com>2018-10-15 06:17:55 -0700
committerDamjan Marion <dmarion@me.com>2018-10-16 11:37:49 +0000
commita5ab5034f4b50fc5a19ccf8910c91613e6a52f5a (patch)
tree7ada95f1671e1f5b525355a6f90e6456813a012c /src/plugins
parente9239c978277d838c0c5ca0ad3076ef85d15138a (diff)
Fix coverity issue for potentially overflowing of page size
Change-Id: I2779626d745badb63386efcf729da7a094a4f297 Signed-off-by: Haiyang Tan <haiyangtan@tencent.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/dpdk/buffer.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/plugins/dpdk/buffer.c b/src/plugins/dpdk/buffer.c
index edace2aaf61..bb177fc6772 100644
--- a/src/plugins/dpdk/buffer.c
+++ b/src/plugins/dpdk/buffer.c
@@ -465,7 +465,7 @@ dpdk_pool_create (vlib_main_t * vm, u8 * pool_name, u32 elt_size,
for (i = 0; i < pr->n_pages; i++)
{
- size_t page_size = 1 << pr->log2_page_size;
+ size_t page_size = 1ull << pr->log2_page_size;
ret = rte_mempool_populate_iova (mp, ((char *) pr->mem) + i * page_size,
pr->page_table[i], page_size, 0, 0);
if (ret < 0)
@@ -493,8 +493,8 @@ dpdk_pool_create (vlib_main_t * vm, u8 * pool_name, u32 elt_size,
/* *INDENT-OFF* */
vec_foreach_index (i, pr->page_table)
{
- dm.vaddr = pointer_to_uword (pr->mem) + (i << pr->log2_page_size);
- dm.size = 1 << pr->log2_page_size;
+ dm.vaddr = pointer_to_uword (pr->mem) + ((u64)i << pr->log2_page_size);
+ dm.size = 1ull << pr->log2_page_size;
dm.iova = pr->page_table[i];
if ((rv = ioctl (dbm->vfio_container_fd, VFIO_IOMMU_MAP_DMA, &dm)))
break;