From: Tomasz Kulasek Date: Thu, 8 Feb 2018 16:59:00 +0000 (+0100) Subject: vhost: fix offset while mmaping log base address X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=fbc4d248b198db7f720fe31a47050a406632cc7a;p=dpdk.git 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: 54f9e32305d4 ("vhost: handle dirty pages logging request") Cc: stable@dpdk.org Signed-off-by: Pawel Wodkowski Signed-off-by: Tomasz Kulasek Reviewed-by: Jianfeng Tan Reviewed-by: Maxime Coquelin --- diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 8ec51c9f88..d34fdc8036 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -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");