aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/linux/vfio.c
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/vlib/linux/vfio.c
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/vlib/linux/vfio.c')
-rw-r--r--src/vlib/linux/vfio.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/vlib/linux/vfio.c b/src/vlib/linux/vfio.c
index 02262719e82..ffc990a61d2 100644
--- a/src/vlib/linux/vfio.c
+++ b/src/vlib/linux/vfio.c
@@ -52,8 +52,8 @@ vfio_map_regions (vlib_main_t * vm, int fd)
vec_foreach_index (i, pr->page_table)
{
int rv;
- 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 = dm.vaddr;
vlib_log_debug (lvm->log_default, "map DMA va:0x%lx iova:%lx "
"size:0x%lx", dm.vaddr, dm.iova, dm.size);