app/crypto-perf: fix uninitialized errno value

Message ID 1503491044-27863-2-git-send-email-hemant.agrawal@nxp.com
State New
Headers show

Commit Message

Hemant Agrawal Aug. 23, 2017, 12:24 p.m.
errno should be initialized to 0 before calling strtol

Fixes: f6cefe253cc8 ("app/crypto-perf: add range/list of sizes")
Cc: stable@dpdk.org

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

---
 app/test-crypto-perf/cperf_options_parsing.c | 1 +
 1 file changed, 1 insertion(+)

-- 
2.7.4

Comments

Rybalchenko, Kirill Sept. 4, 2017, 2:54 p.m. | #1
> -----Original Message-----

> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Hemant Agrawal

> Sent: Wednesday 23 August 2017 13:24

> To: dev@dpdk.org

> Cc: Doherty, Declan <declan.doherty@intel.com>; De Lara Guarch, Pablo

> <pablo.de.lara.guarch@intel.com>; akhil.goyal@nxp.com

> Subject: [dpdk-dev] [PATCH] app/crypto-perf: fix uninitialized errno value

> 

> errno should be initialized to 0 before calling strtol

> 

> Fixes: f6cefe253cc8 ("app/crypto-perf: add range/list of sizes")

> Cc: stable@dpdk.org

> 


Reviewed-by: Kirill Rybalchenko <kirill.rybalchenko@intel.com>
De Lara Guarch, Pablo Sept. 4, 2017, 2:56 p.m. | #2
> -----Original Message-----

> From: Hemant Agrawal [mailto:hemant.agrawal@nxp.com]

> Sent: Wednesday, August 23, 2017 1:24 PM

> To: dev@dpdk.org

> Cc: Doherty, Declan <declan.doherty@intel.com>; De Lara Guarch, Pablo

> <pablo.de.lara.guarch@intel.com>; akhil.goyal@nxp.com

> Subject: [PATCH] app/crypto-perf: fix uninitialized errno value

> 

> errno should be initialized to 0 before calling strtol

> 

> Fixes: f6cefe253cc8 ("app/crypto-perf: add range/list of sizes")

> Cc: stable@dpdk.org

> 

> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

> ---

>  app/test-crypto-perf/cperf_options_parsing.c | 1 +

>  1 file changed, 1 insertion(+)

> 

> diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-

> perf/cperf_options_parsing.c

> index 085aa8f..77c405c 100644

> --- a/app/test-crypto-perf/cperf_options_parsing.c

> +++ b/app/test-crypto-perf/cperf_options_parsing.c

> @@ -137,6 +137,7 @@ parse_range(const char *arg, uint32_t *min,

> uint32_t *max, uint32_t *inc)

>  	if (copy_arg == NULL)

>  		return -1;

> 

> +	errno = 0;

>  	token = strtok(copy_arg, ":");

> 

>  	/* Parse minimum value */

> --

> 2.7.4


Could you extend this fix to the parse_list function?

Thanks!
Pablo
Hemant Agrawal Sept. 5, 2017, 6:03 a.m. | #3
On 9/4/2017 8:26 PM, De Lara Guarch, Pablo wrote:
>

>

>> -----Original Message-----

>> From: Hemant Agrawal [mailto:hemant.agrawal@nxp.com]

>> Sent: Wednesday, August 23, 2017 1:24 PM

>> To: dev@dpdk.org

>> Cc: Doherty, Declan <declan.doherty@intel.com>; De Lara Guarch, Pablo

>> <pablo.de.lara.guarch@intel.com>; akhil.goyal@nxp.com

>> Subject: [PATCH] app/crypto-perf: fix uninitialized errno value

>>

>> errno should be initialized to 0 before calling strtol

>>

>> Fixes: f6cefe253cc8 ("app/crypto-perf: add range/list of sizes")

>> Cc: stable@dpdk.org

>>

>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

>> ---

>>  app/test-crypto-perf/cperf_options_parsing.c | 1 +

>>  1 file changed, 1 insertion(+)

>>

>> diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-

>> perf/cperf_options_parsing.c

>> index 085aa8f..77c405c 100644

>> --- a/app/test-crypto-perf/cperf_options_parsing.c

>> +++ b/app/test-crypto-perf/cperf_options_parsing.c

>> @@ -137,6 +137,7 @@ parse_range(const char *arg, uint32_t *min,

>> uint32_t *max, uint32_t *inc)

>>  	if (copy_arg == NULL)

>>  		return -1;

>>

>> +	errno = 0;

>>  	token = strtok(copy_arg, ":");

>>

>>  	/* Parse minimum value */

>> --

>> 2.7.4

>

> Could you extend this fix to the parse_list function?

>

> Thanks!

> Pablo

>

sure.

Patch

diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c
index 085aa8f..77c405c 100644
--- a/app/test-crypto-perf/cperf_options_parsing.c
+++ b/app/test-crypto-perf/cperf_options_parsing.c
@@ -137,6 +137,7 @@  parse_range(const char *arg, uint32_t *min, uint32_t *max, uint32_t *inc)
 	if (copy_arg == NULL)
 		return -1;
 
+	errno = 0;
 	token = strtok(copy_arg, ":");
 
 	/* Parse minimum value */