DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] vhost: fix offset while mmaping log base address
@ 2024-07-08  6:57 BillXiang
  2024-07-09 12:42 ` Chenbo Xia
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: BillXiang @ 2024-07-08  6:57 UTC (permalink / raw)
  To: Maxime Coquelin, Chenbo Xia, Jianfeng Tan, Tomasz Kulasek,
	Pawel Wodkowski
  Cc: dev, BillXiang

From: BillXiang <xiangwencheng@dayudpu.com>

For sanity the offset should be the last parameter of mmap.

Fixes: fbc4d24 ("vhost: fix offset while mmaping log base address")
Signed-off-by: BillXiang <xiangwencheng@dayudpu.com>
---
 lib/vhost/vhost_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
index 5f470da38a..0893ae80bb 100644
--- a/lib/vhost/vhost_user.c
+++ b/lib/vhost/vhost_user.c
@@ -2399,7 +2399,7 @@ vhost_user_set_log_base(struct virtio_net **pdev,
 	 * mmap from 0 to workaround a hugepage mmap bug: mmap will
 	 * fail when offset is not page size aligned.
 	 */
-	addr = mmap(0, size + off, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+	addr = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, off);
 	alignment = get_blk_size(fd);
 	close(fd);
 	if (addr == MAP_FAILED) {
-- 
2.30.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-09-19 12:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-08  6:57 [PATCH] vhost: fix offset while mmaping log base address BillXiang
2024-07-09 12:42 ` Chenbo Xia
2024-07-10  3:22 ` BillXiang
2024-09-19 12:03 ` Maxime Coquelin
2024-09-19 12:04 ` Maxime Coquelin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).