From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 49B004555E; Mon, 8 Jul 2024 15:12:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4FC2E41104; Mon, 8 Jul 2024 15:12:33 +0200 (CEST) Received: from lf-1-17.ptr.blmpb.com (lf-1-17.ptr.blmpb.com [103.149.242.17]) by mails.dpdk.org (Postfix) with ESMTP id 110614028C for ; Mon, 8 Jul 2024 08:58:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=s1; d=dayudpu-com.20200927.dkim.feishu.cn; t=1720421891; h=from:subject:mime-version:from:date:message-id:subject:to:cc: reply-to:content-type:mime-version:in-reply-to:message-id; bh=BhakYDzl5bnI80LC4Vev8RUjDuSU8tGrQTwCMa5avWQ=; b=DIKrMAI4Hvvc3gQW+fJwxUf+HL5e8HZTie2xSyS2INK5YpFT9Y5UyByj+iM/XCetC1dOaY dR6TCdxKY4ZVc+K6H7JCq+0XYzrI77LBWsn1EnxXnCJqFQA+i9NJOuwQSOFIn0+6b7OLVp lSd3Ld7WMdSV/qcB2/wshu2V0unhWmw/mYfRV+onu6LzJLSfTvPducIX4MFSeM5DroQbFG vTg30e1+JSBLOOfxQ9tby/rsVAOhCzF03a1hGx9XQlYbJ4KPri5gPVc+FoD9jiKsaK7DIe 7JaV8OxgYvc6+IQmdG+KeJ5sLCMeMr/q7G/RNGTaf+o/OweWDXVhgBC0vg+2Aw== Mime-Version: 1.0 X-Original-From: xiangwencheng@dayudpu.com To: "Maxime Coquelin" , "Chenbo Xia" , "Jianfeng Tan" , "Tomasz Kulasek" , "Pawel Wodkowski" Message-Id: <20240708065749.1131-1-xiangwencheng@dayudpu.com> Content-Transfer-Encoding: 7bit Received: from localhost.localdomain ([124.64.23.34]) by smtp.feishu.cn with ESMTPS; Mon, 08 Jul 2024 14:58:09 +0800 X-Mailer: git-send-email 2.30.0 Content-Type: text/plain; charset=UTF-8 Cc: , "BillXiang" From: "BillXiang" Subject: [PATCH] vhost: fix offset while mmaping log base address Date: Mon, 8 Jul 2024 14:57:49 +0800 X-Lms-Return-Path: X-Mailman-Approved-At: Mon, 08 Jul 2024 15:12:30 +0200 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: BillXiang 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 --- 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