[RFC,4/5] eal/memory: avoid double munmap in error path

Message ID 20181106214901.1392-5-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series more Coverity related bug fixes |

Checks

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

Commit Message

Stephen Hemminger Nov. 6, 2018, 9:49 p.m. UTC
  Don't call munmap of hugepage memory twice in the error path.

Coverity issue: 325730
Fixes: 66cc45e293ed ("mem: replace memseg with memseg lists")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/librte_eal/linuxapp/eal/eal_memory.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Thomas Monjalon Nov. 6, 2018, 11:10 p.m. UTC | #1
06/11/2018 22:49, Stephen Hemminger:
> Don't call munmap of hugepage memory twice in the error path.
> 
> Coverity issue: 325730
> Fixes: 66cc45e293ed ("mem: replace memseg with memseg lists")
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

Thank you
Anatoly submitted the same fix:
	https://patches.dpdk.org/patch/47898/
  

Patch

diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
index c1b5e079117a..48b23ce19ad3 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -1617,6 +1617,7 @@  eal_legacy_hugepage_init(void)
 	tmp_hp = NULL;
 
 	munmap(hugepage, nr_hugefiles * sizeof(struct hugepage_file));
+	hugepage = NULL;
 
 	/* we're not going to allocate more pages, so release VA space for
 	 * unused memseg lists