[dpdk-dev,v2,2/2] test/memzone: Fix test_memzone_free issue

Message ID 1515995546-5981-3-git-send-email-phil.yang@arm.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Phil Yang Jan. 15, 2018, 5:52 a.m. UTC
  When reserving memzone for mz[], it will out of mz[RTE_MAX_MEMZONE] memory
bound after the counter reached to RTE_MAX_MEMZONE. It will flush the
counter's memory and lead to mz[] memory cannot be freed.

Fixd by extend to mz[RTE_MAX_MEMZONE + 1].

Signed-off-by: Phil Yang <phil.yang@arm.com>
---
 test/test/test_memzone.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Anatoly Burakov Jan. 15, 2018, 9:49 a.m. UTC | #1
On 15-Jan-18 5:52 AM, Phil Yang wrote:
> When reserving memzone for mz[], it will out of mz[RTE_MAX_MEMZONE] memory
> bound after the counter reached to RTE_MAX_MEMZONE. It will flush the
> counter's memory and lead to mz[] memory cannot be freed.
> 
> Fixd by extend to mz[RTE_MAX_MEMZONE + 1].
> 
> Signed-off-by: Phil Yang <phil.yang@arm.com>
> ---

Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
  

Patch

diff --git a/test/test/test_memzone.c b/test/test/test_memzone.c
index 9c20172..24e29a7 100644
--- a/test/test/test_memzone.c
+++ b/test/test/test_memzone.c
@@ -742,7 +742,7 @@  test_memzone_bounded(void)
 static int
 test_memzone_free(void)
 {
-	const struct rte_memzone *mz[RTE_MAX_MEMZONE];
+	const struct rte_memzone *mz[RTE_MAX_MEMZONE + 1];
 	int i;
 	char name[20];