mem: fix potential bad unmap on map failure
authorAnatoly Burakov <anatoly.burakov@intel.com>
Mon, 16 Apr 2018 14:37:30 +0000 (15:37 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 27 Apr 2018 21:42:40 +0000 (23:42 +0200)
commite27ffec16984911798d5f903a501890b179af494
treeb442cde8b67bc30745e4788fa706687121d2fa2b
parent8ee25c7e81fcccfd14bd39f8ff87459ced9a3581
mem: fix potential bad unmap on map failure

Previously, if mmap failed to map page address at requested
address, we were attempting to unmap the wrong address. Fix it
by unmapping our actual mapped address, and jump further to
avoid unmapping memory that is not allocated.

Coverity issue: 272602
Fixes: 582bed1e1d1d ("mem: support mapping hugepages at runtime")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
lib/librte_eal/linuxapp/eal/eal_memalloc.c