DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yongseok Koh <yskoh@mellanox.com>
To: adrien.mazarguil@6wind.com, nelio.laranjeiro@6wind.com
Cc: dev@dpdk.org, Yongseok Koh <yskoh@mellanox.com>,
	Anatoly Burakov <anatoly.burakov@intel.com>
Subject: [dpdk-dev] [PATCH 2/2] net/mlx4: fix alignment of Memory Region
Date: Tue, 17 Apr 2018 11:39:14 -0700	[thread overview]
Message-ID: <20180417183914.10175-2-yskoh@mellanox.com> (raw)
In-Reply-To: <20180417183914.10175-1-yskoh@mellanox.com>

The memory region is [start, end), so if the memseg of 'end' isn't
allocated yet, the returned memseg will have zero entries and this will
make 'end' zero (nil).

Fixes: c2fe5823224a ("net/mlx4: use virt2memseg instead of iteration")
Cc: Anatoly Burakov <anatoly.burakov@intel.com>

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
---
 drivers/net/mlx4/mlx4_mr.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/mlx4/mlx4_mr.c b/drivers/net/mlx4/mlx4_mr.c
index e69b43322..f2dcbcb76 100644
--- a/drivers/net/mlx4/mlx4_mr.c
+++ b/drivers/net/mlx4/mlx4_mr.c
@@ -144,9 +144,7 @@ mlx4_mr_get(struct priv *priv, struct rte_mempool *mp)
 	ms = rte_mem_virt2memseg((void *)start, NULL);
 	if (ms != NULL)
 		start = RTE_ALIGN_FLOOR(start, ms->hugepage_sz);
-	ms = rte_mem_virt2memseg((void *)end, NULL);
-	if (ms != NULL)
-		end = RTE_ALIGN_CEIL(end, ms->hugepage_sz);
+	end = RTE_ALIGN_CEIL(end, ms->hugepage_sz);
 
 	DEBUG("mempool %p using start=%p end=%p size=%zu for MR",
 	      (void *)mp, (void *)start, (void *)end,
-- 
2.11.0

  reply	other threads:[~2018-04-17 18:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-17 18:39 [dpdk-dev] [PATCH 1/2] net/mlx5: " Yongseok Koh
2018-04-17 18:39 ` Yongseok Koh [this message]
2018-04-18  8:05   ` [dpdk-dev] [PATCH 2/2] net/mlx4: " Adrien Mazarguil
2018-04-18  6:43 ` [dpdk-dev] [PATCH 1/2] net/mlx5: " Nélio Laranjeiro
2018-04-22  9:09   ` Shahaf Shuler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180417183914.10175-2-yskoh@mellanox.com \
    --to=yskoh@mellanox.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=nelio.laranjeiro@6wind.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).