DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] app/crypto-perf: fix dereference null return value
@ 2017-02-06 14:55 Slawomir Mrozowicz
  2017-02-09 22:31 ` De Lara Guarch, Pablo
  2017-02-10 14:22 ` [dpdk-dev] [PATCH v2] " Slawomir Mrozowicz
  0 siblings, 2 replies; 5+ messages in thread
From: Slawomir Mrozowicz @ 2017-02-06 14:55 UTC (permalink / raw)
  To: declan.doherty; +Cc: dev, Slawomir Mrozowicz

Dereferencing a pointer that might be null key_token when calling strstr.
Check if the pointer is null before.

Coverity issue: 141071
Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test application")

Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
---
 app/test-crypto-perf/cperf_test_vector_parsing.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test-crypto-perf/cperf_test_vector_parsing.c b/app/test-crypto-perf/cperf_test_vector_parsing.c
index e0bcb20..a7d7b51 100644
--- a/app/test-crypto-perf/cperf_test_vector_parsing.c
+++ b/app/test-crypto-perf/cperf_test_vector_parsing.c
@@ -240,7 +240,7 @@ parse_entry(char *entry, struct cperf_test_vector *vector,
 
 	/* get values for key */
 	token = strtok(NULL, CPERF_ENTRY_DELIMITER);
-	if (token == NULL) {
+	if (key_token == NULL || token == NULL) {
 		printf("Expected 'key = values' but was '%.40s'..\n",
 			key_token);
 		return -1;
-- 
2.5.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH] app/crypto-perf: fix dereference null return value
  2017-02-06 14:55 [dpdk-dev] [PATCH] app/crypto-perf: fix dereference null return value Slawomir Mrozowicz
@ 2017-02-09 22:31 ` De Lara Guarch, Pablo
  2017-02-10 14:22 ` [dpdk-dev] [PATCH v2] " Slawomir Mrozowicz
  1 sibling, 0 replies; 5+ messages in thread
From: De Lara Guarch, Pablo @ 2017-02-09 22:31 UTC (permalink / raw)
  To: Mrozowicz, SlawomirX, Doherty, Declan; +Cc: dev, Mrozowicz, SlawomirX

Hi Slawomir,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Slawomir
> Mrozowicz
> Sent: Monday, February 06, 2017 2:55 PM
> To: Doherty, Declan
> Cc: dev@dpdk.org; Mrozowicz, SlawomirX
> Subject: [dpdk-dev] [PATCH] app/crypto-perf: fix dereference null return
> value
> 
> Dereferencing a pointer that might be null key_token when calling strstr.
> Check if the pointer is null before.
> 
> Coverity issue: 141071
> Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test
> application")
> 
> Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
> ---
>  app/test-crypto-perf/cperf_test_vector_parsing.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/app/test-crypto-perf/cperf_test_vector_parsing.c b/app/test-
> crypto-perf/cperf_test_vector_parsing.c
> index e0bcb20..a7d7b51 100644
> --- a/app/test-crypto-perf/cperf_test_vector_parsing.c
> +++ b/app/test-crypto-perf/cperf_test_vector_parsing.c
> @@ -240,7 +240,7 @@ parse_entry(char *entry, struct cperf_test_vector
> *vector,
> 
>  	/* get values for key */
>  	token = strtok(NULL, CPERF_ENTRY_DELIMITER);
> -	if (token == NULL) {
> +	if (key_token == NULL || token == NULL) {

Is this fix right? If key_token is NULL, then I would expect a seg fault here.

>  		printf("Expected 'key = values' but was '%.40s'..\n",
>  			key_token);
>  		return -1;
> --
> 2.5.0

Thanks,
Pablo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH v2] app/crypto-perf: fix dereference null return value
  2017-02-10 14:22 ` [dpdk-dev] [PATCH v2] " Slawomir Mrozowicz
@ 2017-02-10 13:24   ` De Lara Guarch, Pablo
  2017-02-10 13:40     ` De Lara Guarch, Pablo
  0 siblings, 1 reply; 5+ messages in thread
From: De Lara Guarch, Pablo @ 2017-02-10 13:24 UTC (permalink / raw)
  To: Mrozowicz, SlawomirX, Doherty, Declan; +Cc: dev, Mrozowicz, SlawomirX



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Slawomir
> Mrozowicz
> Sent: Friday, February 10, 2017 2:23 PM
> To: Doherty, Declan
> Cc: dev@dpdk.org; Mrozowicz, SlawomirX
> Subject: [dpdk-dev] [PATCH v2] app/crypto-perf: fix dereference null return
> value
> 
> Dereferencing a pointer that might be null key_token when calling strstr.
> Check if the pointer is null before.
> 
> Coverity issue: 141071
> Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test
> application")
> 
> Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>

Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH v2] app/crypto-perf: fix dereference null return value
  2017-02-10 13:24   ` De Lara Guarch, Pablo
@ 2017-02-10 13:40     ` De Lara Guarch, Pablo
  0 siblings, 0 replies; 5+ messages in thread
From: De Lara Guarch, Pablo @ 2017-02-10 13:40 UTC (permalink / raw)
  To: De Lara Guarch, Pablo, Mrozowicz, SlawomirX, Doherty, Declan
  Cc: dev, Mrozowicz, SlawomirX



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of De Lara Guarch,
> Pablo
> Sent: Friday, February 10, 2017 1:25 PM
> To: Mrozowicz, SlawomirX; Doherty, Declan
> Cc: dev@dpdk.org; Mrozowicz, SlawomirX
> Subject: Re: [dpdk-dev] [PATCH v2] app/crypto-perf: fix dereference null
> return value
> 
> 
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Slawomir
> > Mrozowicz
> > Sent: Friday, February 10, 2017 2:23 PM
> > To: Doherty, Declan
> > Cc: dev@dpdk.org; Mrozowicz, SlawomirX
> > Subject: [dpdk-dev] [PATCH v2] app/crypto-perf: fix dereference null
> return
> > value
> >
> > Dereferencing a pointer that might be null key_token when calling strstr.
> > Check if the pointer is null before.
> >
> > Coverity issue: 141071
> > Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test
> > application")
> >
> > Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
> 
> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Applied to dpdk-next-crypto.
Thanks,

Pablo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH v2] app/crypto-perf: fix dereference null return value
  2017-02-06 14:55 [dpdk-dev] [PATCH] app/crypto-perf: fix dereference null return value Slawomir Mrozowicz
  2017-02-09 22:31 ` De Lara Guarch, Pablo
@ 2017-02-10 14:22 ` Slawomir Mrozowicz
  2017-02-10 13:24   ` De Lara Guarch, Pablo
  1 sibling, 1 reply; 5+ messages in thread
From: Slawomir Mrozowicz @ 2017-02-10 14:22 UTC (permalink / raw)
  To: declan.doherty; +Cc: dev, Slawomir Mrozowicz

Dereferencing a pointer that might be null key_token when calling strstr.
Check if the pointer is null before.

Coverity issue: 141071
Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test application")

Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
---
v2 changes:
- print message only if key_token exist
---
 app/test-crypto-perf/cperf_test_vector_parsing.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/app/test-crypto-perf/cperf_test_vector_parsing.c b/app/test-crypto-perf/cperf_test_vector_parsing.c
index e0bcb20..e442489 100644
--- a/app/test-crypto-perf/cperf_test_vector_parsing.c
+++ b/app/test-crypto-perf/cperf_test_vector_parsing.c
@@ -234,15 +234,19 @@ parse_entry(char *entry, struct cperf_test_vector *vector,
 	uint8_t *data = NULL;
 	char *token, *key_token;
 
+	if (entry == NULL) {
+		printf("Expected entry value\n");
+		return -1;
+	}
+
 	/* get key */
 	token = strtok(entry, CPERF_ENTRY_DELIMITER);
 	key_token = token;
-
 	/* get values for key */
 	token = strtok(NULL, CPERF_ENTRY_DELIMITER);
-	if (token == NULL) {
-		printf("Expected 'key = values' but was '%.40s'..\n",
-			key_token);
+
+	if (key_token == NULL || token == NULL) {
+		printf("Expected 'key = values' but was '%.40s'..\n", entry);
 		return -1;
 	}
 
-- 
2.5.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-02-10 13:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-06 14:55 [dpdk-dev] [PATCH] app/crypto-perf: fix dereference null return value Slawomir Mrozowicz
2017-02-09 22:31 ` De Lara Guarch, Pablo
2017-02-10 14:22 ` [dpdk-dev] [PATCH v2] " Slawomir Mrozowicz
2017-02-10 13:24   ` De Lara Guarch, Pablo
2017-02-10 13:40     ` De Lara Guarch, Pablo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).