diff mbox

[PATCHv2] test/performance:Avoid possible out-of-bounds memory access

Message ID 1459838308-3866-1-git-send-email-balakrishna.garapati@linaro.org
State Superseded
Headers show

Commit Message

Balakrishna Garapati April 5, 2016, 6:38 a.m. UTC
Signed-off-by: Balakrishna Garapati <balakrishna.garapati@linaro.org>
---

 v1: Fix for the https://bugs.linaro.org/show_bug.cgi?id=2136
 v2: comments from v1

 test/performance/odp_crypto.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

--
1.9.1

Comments

Mike Holmes April 5, 2016, 1:47 p.m. UTC | #1
On 5 April 2016 at 02:38, Balakrishna Garapati <
balakrishna.garapati@linaro.org> wrote:

> Signed-off-by: Balakrishna Garapati <balakrishna.garapati@linaro.org>

>


Need the description here above "---" so that it stays in the git log, text
below "---" is deleted in the log

Fix for the https://bugs.linaro.org/show_bug.cgi?id=2136


> ---

>

>  v1: Fix for the https://bugs.linaro.org/show_bug.cgi?id=2136

>  v2: comments from v1

>

>  test/performance/odp_crypto.c | 10 ++++++----

>  1 file changed, 6 insertions(+), 4 deletions(-)

>

> diff --git a/test/performance/odp_crypto.c b/test/performance/odp_crypto.c

> index fe1c7b4..0ea0b1b 100644

> --- a/test/performance/odp_crypto.c

> +++ b/test/performance/odp_crypto.c

> @@ -719,12 +719,12 @@ int main(int argc, char *argv[])

>         odp_pool_t pool;

>         odp_queue_param_t qparam;

>         odp_pool_param_t params;

> -       odph_linux_pthread_t thr;

>         odp_queue_t out_queue = ODP_QUEUE_INVALID;

>         thr_arg_t thr_arg;

> -       int num_workers = 1;

>         odp_cpumask_t cpumask;

>         char cpumaskstr[ODP_CPUMASK_STR_SIZE];

> +       int num_workers = 1;

> +       odph_linux_pthread_t thr[num_workers];

>

>         memset(&cargs, 0, sizeof(cargs));

>

> @@ -793,13 +793,15 @@ int main(int argc, char *argv[])

>                 printf("Run in sync mode\n");

>         }

>

> +       memset(thr, 0, sizeof(thr));

> +

>         if (cargs.alg_config) {

>                 if (cargs.schedule) {

> -                       odph_linux_pthread_create(&thr, &cpumask,

> +                       odph_linux_pthread_create(&thr[0], &cpumask,

>                                                   run_thr_func,

>                                                   &thr_arg,

>                                                   ODP_THREAD_WORKER);

> -                       odph_linux_pthread_join(&thr, num_workers);

> +                       odph_linux_pthread_join(&thr[0], num_workers);

>                 } else {

>                         run_measure_one_config(&cargs, cargs.alg_config);

>                 }

> --

> 1.9.1

>

> _______________________________________________

> lng-odp mailing list

> lng-odp@lists.linaro.org

> https://lists.linaro.org/mailman/listinfo/lng-odp

>




-- 
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs
"Work should be fun and collaborative, the rest follows"
diff mbox

Patch

diff --git a/test/performance/odp_crypto.c b/test/performance/odp_crypto.c
index fe1c7b4..0ea0b1b 100644
--- a/test/performance/odp_crypto.c
+++ b/test/performance/odp_crypto.c
@@ -719,12 +719,12 @@  int main(int argc, char *argv[])
 	odp_pool_t pool;
 	odp_queue_param_t qparam;
 	odp_pool_param_t params;
-	odph_linux_pthread_t thr;
 	odp_queue_t out_queue = ODP_QUEUE_INVALID;
 	thr_arg_t thr_arg;
-	int num_workers = 1;
 	odp_cpumask_t cpumask;
 	char cpumaskstr[ODP_CPUMASK_STR_SIZE];
+	int num_workers = 1;
+	odph_linux_pthread_t thr[num_workers];

 	memset(&cargs, 0, sizeof(cargs));

@@ -793,13 +793,15 @@  int main(int argc, char *argv[])
 		printf("Run in sync mode\n");
 	}

+	memset(thr, 0, sizeof(thr));
+
 	if (cargs.alg_config) {
 		if (cargs.schedule) {
-			odph_linux_pthread_create(&thr, &cpumask,
+			odph_linux_pthread_create(&thr[0], &cpumask,
 						  run_thr_func,
 						  &thr_arg,
 						  ODP_THREAD_WORKER);
-			odph_linux_pthread_join(&thr, num_workers);
+			odph_linux_pthread_join(&thr[0], num_workers);
 		} else {
 			run_measure_one_config(&cargs, cargs.alg_config);
 		}