diff mbox

odp_atomic_test.c: Bounds check commandline

Message ID 1414179419-64228-1-git-send-email-mike.holmes@linaro.org
State Accepted
Commit 3c3d0a97b4e73b4066a31d27264fe086b5068961
Headers show

Commit Message

Mike Holmes Oct. 24, 2014, 7:36 p.m. UTC
Additional check for impossible negative number of threads

Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---
 test/api_test/odp_atomic_test.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Maxim Uvarov Oct. 30, 2014, 10:01 p.m. UTC | #1
Reasonable patch. Merged.

Maxim.

On 10/24/2014 11:36 PM, Mike Holmes wrote:
> Additional check for impossible negative number of threads
>
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> ---
>   test/api_test/odp_atomic_test.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/test/api_test/odp_atomic_test.c b/test/api_test/odp_atomic_test.c
> index 9019d4f..d92a8c1 100644
> --- a/test/api_test/odp_atomic_test.c
> +++ b/test/api_test/odp_atomic_test.c
> @@ -318,12 +318,13 @@ int main(int argc, char *argv[])
>   			goto err_exit;
>   		}
>   		if (test_type < TEST_MIX || test_type > TEST_MAX ||
> -		    pthrdnum > odp_sys_core_count()) {
> +		    pthrdnum > odp_sys_core_count() || pthrdnum < 0) {
>   			usage();
>   			goto err_exit;
>   		}
>   		cnt -= 2;
>   	}
> +
>   	if (pthrdnum == 0)
>   		pthrdnum = odp_sys_core_count();
>
diff mbox

Patch

diff --git a/test/api_test/odp_atomic_test.c b/test/api_test/odp_atomic_test.c
index 9019d4f..d92a8c1 100644
--- a/test/api_test/odp_atomic_test.c
+++ b/test/api_test/odp_atomic_test.c
@@ -318,12 +318,13 @@  int main(int argc, char *argv[])
 			goto err_exit;
 		}
 		if (test_type < TEST_MIX || test_type > TEST_MAX ||
-		    pthrdnum > odp_sys_core_count()) {
+		    pthrdnum > odp_sys_core_count() || pthrdnum < 0) {
 			usage();
 			goto err_exit;
 		}
 		cnt -= 2;
 	}
+
 	if (pthrdnum == 0)
 		pthrdnum = odp_sys_core_count();