Vhost-User: Fix calculate memory region size 33/2333/4
authorJianfeng Tan <jianfeng.tan@intel.com>
Thu, 11 Aug 2016 02:17:30 +0000 (02:17 +0000)
committerDave Barach <openvpp@barachs.net>
Mon, 15 Aug 2016 21:52:12 +0000 (21:52 +0000)
commit8d98684a60dc641b457922c1529a1d5d6479c94d
tree211cb41ad29c2e9d28ad3d6fc131882f15b13c85
parent161b2c6a833f2b53d684ae4a18119c26b825fe73
Vhost-User: Fix calculate memory region size

The memory region size calculation is wrong. For example, a region
with size of 1G (hugepage size is also 1G), and offset is zero, use
the previous way to calculate, the ultimate size to mmap and munmap
is 2G, which could lead to segment fault when munmap is executed.

This patch refers the way in DPDK to calculate the region size.

Change-Id: I6f35cde15e2402be0025c556c192b87a46bbf978
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
vnet/vnet/devices/dpdk/vhost_user.c