[v2] app/crypto-perf: fix uninitialized errno value

Message ID 1504592221-32022-1-git-send-email-hemant.agrawal@nxp.com
State Accepted
Commit 5c49049dd9d265f9a2086020ec7c34d3bce3c037
Headers show
Series
  • [v2] app/crypto-perf: fix uninitialized errno value
Related show

Commit Message

Hemant Agrawal Sept. 5, 2017, 6:17 a.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>

Reviewed-by: Kirill Rybalchenko <kirill.rybalchenko@intel.com>

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

-- 
2.7.4

Comments

De Lara Guarch, Pablo Sept. 5, 2017, 11:25 a.m. | #1
> -----Original Message-----

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

> Sent: Tuesday, September 5, 2017 7:17 AM

> 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 v2] 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>

> Reviewed-by: Kirill Rybalchenko <kirill.rybalchenko@intel.com>


Applied to dpdk-next-crypto.
Thanks,

Pablo

Patch

diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c
index 085aa8f..663f53f 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 */
@@ -203,6 +204,7 @@  parse_list(const char *arg, uint32_t *list, uint32_t *min, uint32_t *max)
 	if (copy_arg == NULL)
 		return -1;
 
+	errno = 0;
 	token = strtok(copy_arg, ",");
 
 	/* Parse first value */