diff mbox

validation: fix memory allocation in odp_synchronizers

Message ID 1427115801-23689-1-git-send-email-maxim.uvarov@linaro.org
State Accepted
Commit 2152edd7b366d0489c7228bcfbc4b24a04ba2d2b
Headers show

Commit Message

Maxim Uvarov March 23, 2015, 1:03 p.m. UTC
odp_synchronizers should not reverve memory with PROC flag,
i.e. with requesting shared memory object. Without that
fix there might be seg. faults if prior shared memory object
was created with prior runs.

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 test/validation/odp_synchronizers.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Bill Fischofer March 24, 2015, 12:40 a.m. UTC | #1
On Mon, Mar 23, 2015 at 8:03 AM, Maxim Uvarov <maxim.uvarov@linaro.org>
wrote:

> odp_synchronizers should not reverve memory with PROC flag,
> i.e. with requesting shared memory object. Without that
> fix there might be seg. faults if prior shared memory object
> was created with prior runs.
>
> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
>

Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org>


> ---
>  test/validation/odp_synchronizers.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/test/validation/odp_synchronizers.c
> b/test/validation/odp_synchronizers.c
> index ab9164f..d3539c5 100644
> --- a/test/validation/odp_synchronizers.c
> +++ b/test/validation/odp_synchronizers.c
> @@ -1052,7 +1052,12 @@ int tests_global_init(void)
>
>         global_shm = odp_shm_reserve(GLOBAL_SHM_NAME,
>                                      sizeof(global_shared_mem_t), 64,
> -                                    ODP_SHM_SW_ONLY | ODP_SHM_PROC);
> +                                    ODP_SHM_SW_ONLY);
> +       if (ODP_SHM_INVALID == global_shm) {
> +               fprintf(stderr, "Unable reserve memory for global_shm\n");
> +               return -1;
> +       }
> +
>         global_mem = odp_shm_addr(global_shm);
>         memset(global_mem, 0, sizeof(global_shared_mem_t));
>
> --
> 1.9.1
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
Maxim Uvarov March 24, 2015, 4:38 p.m. UTC | #2
Merged,
Maxim.

On 03/24/15 03:40, Bill Fischofer wrote:
>
>
> On Mon, Mar 23, 2015 at 8:03 AM, Maxim Uvarov <maxim.uvarov@linaro.org 
> <mailto:maxim.uvarov@linaro.org>> wrote:
>
>     odp_synchronizers should not reverve memory with PROC flag,
>     i.e. with requesting shared memory object. Without that
>     fix there might be seg. faults if prior shared memory object
>     was created with prior runs.
>
>     Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org
>     <mailto:maxim.uvarov@linaro.org>>
>
>
> Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org 
> <mailto:bill.fischofer@linaro.org>>
>
>     ---
>      test/validation/odp_synchronizers.c | 7 ++++++-
>      1 file changed, 6 insertions(+), 1 deletion(-)
>
>     diff --git a/test/validation/odp_synchronizers.c
>     b/test/validation/odp_synchronizers.c
>     index ab9164f..d3539c5 100644
>     --- a/test/validation/odp_synchronizers.c
>     +++ b/test/validation/odp_synchronizers.c
>     @@ -1052,7 +1052,12 @@ int tests_global_init(void)
>
>             global_shm = odp_shm_reserve(GLOBAL_SHM_NAME,
>      sizeof(global_shared_mem_t), 64,
>     -                                    ODP_SHM_SW_ONLY | ODP_SHM_PROC);
>     +                                    ODP_SHM_SW_ONLY);
>     +       if (ODP_SHM_INVALID == global_shm) {
>     +               fprintf(stderr, "Unable reserve memory for
>     global_shm\n");
>     +               return -1;
>     +       }
>     +
>             global_mem = odp_shm_addr(global_shm);
>             memset(global_mem, 0, sizeof(global_shared_mem_t));
>
>     --
>     1.9.1
>
>
>     _______________________________________________
>     lng-odp mailing list
>     lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>     http://lists.linaro.org/mailman/listinfo/lng-odp
>
>
diff mbox

Patch

diff --git a/test/validation/odp_synchronizers.c b/test/validation/odp_synchronizers.c
index ab9164f..d3539c5 100644
--- a/test/validation/odp_synchronizers.c
+++ b/test/validation/odp_synchronizers.c
@@ -1052,7 +1052,12 @@  int tests_global_init(void)
 
 	global_shm = odp_shm_reserve(GLOBAL_SHM_NAME,
 				     sizeof(global_shared_mem_t), 64,
-				     ODP_SHM_SW_ONLY | ODP_SHM_PROC);
+				     ODP_SHM_SW_ONLY);
+	if (ODP_SHM_INVALID == global_shm) {
+		fprintf(stderr, "Unable reserve memory for global_shm\n");
+		return -1;
+	}
+
 	global_mem = odp_shm_addr(global_shm);
 	memset(global_mem, 0, sizeof(global_shared_mem_t));