diff mbox

[v3,1/3] linux-generic: odp_shm_free:fix munmap error

Message ID 1422183120-23233-1-git-send-email-yan.songming@linaro.org
State New
Headers show

Commit Message

yan.songming Jan. 25, 2015, 10:52 a.m. UTC
From: Yan Sonming <yan.songming@linaro.org>

Fix the bug of odp_shm_free.

Signed-off-by: Yan Songming <yan.songming@linaro.org>
---
 platform/linux-generic/odp_shared_memory.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Maxim Uvarov Feb. 2, 2015, 9 a.m. UTC | #1
Yan, this fix already there. If you think that it's reasonable to print 
block name then please send separate patch for that.

Thanks,
Maxim.

On 01/25/2015 01:52 PM, Yan Songming wrote:
> From: Yan Sonming <yan.songming@linaro.org>
>
> Fix the bug of odp_shm_free.
>
> Signed-off-by: Yan Songming <yan.songming@linaro.org>
> ---
>   platform/linux-generic/odp_shared_memory.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/platform/linux-generic/odp_shared_memory.c b/platform/linux-generic/odp_shared_memory.c
> index 99c5b40..2ce84b1 100644
> --- a/platform/linux-generic/odp_shared_memory.c
> +++ b/platform/linux-generic/odp_shared_memory.c
> @@ -135,9 +135,9 @@ int odp_shm_free(odp_shm_t shm)
>   	shm_block = &odp_shm_tbl->block[i];
>   
>   	alloc_size = shm_block->size + shm_block->align;
> -	ret = munmap(shm_block->addr, alloc_size);
> +	ret = munmap(shm_block->addr_orig, alloc_size);
>   	if (0 != ret) {
> -		ODP_DBG("odp_shm_free: munmap failed\n");
> +		ODP_DBG("odp_shm_free: munmap failed : %s\n", shm_block->name);
>   		odp_spinlock_unlock(&odp_shm_tbl->lock);
>   		return -1;
>   	}
diff mbox

Patch

diff --git a/platform/linux-generic/odp_shared_memory.c b/platform/linux-generic/odp_shared_memory.c
index 99c5b40..2ce84b1 100644
--- a/platform/linux-generic/odp_shared_memory.c
+++ b/platform/linux-generic/odp_shared_memory.c
@@ -135,9 +135,9 @@  int odp_shm_free(odp_shm_t shm)
 	shm_block = &odp_shm_tbl->block[i];
 
 	alloc_size = shm_block->size + shm_block->align;
-	ret = munmap(shm_block->addr, alloc_size);
+	ret = munmap(shm_block->addr_orig, alloc_size);
 	if (0 != ret) {
-		ODP_DBG("odp_shm_free: munmap failed\n");
+		ODP_DBG("odp_shm_free: munmap failed : %s\n", shm_block->name);
 		odp_spinlock_unlock(&odp_shm_tbl->lock);
 		return -1;
 	}