vhost: fix offset while mmaping log base address

QEMU always set offset to 0 but for sanity we should take the offset
into account.

Fixes: 54f9e32305 ("vhost: handle dirty pages logging request")
Cc: stable@dpdk.org

Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Reviewed-by: Jianfeng Tan <jianfeng.tan@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
This commit is contained in:
Tomasz Kulasek 2018-02-08 17:59:00 +01:00 committed by Ferruh Yigit
parent 0fe99cf73e
commit fbc4d248b1

View File

@ -1044,7 +1044,7 @@ vhost_user_set_log_base(struct virtio_net *dev, struct VhostUserMsg *msg)
* mmap from 0 to workaround a hugepage mmap bug: mmap will
* fail when offset is not page size aligned.
*/
addr = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
addr = mmap(0, size + off, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
close(fd);
if (addr == MAP_FAILED) {
RTE_LOG(ERR, VHOST_CONFIG, "mmap log base failed!\n");