[dpdk-dev] examples/ip_pipeline: fixes uninitialized scalar variable

Message ID 1524070690-12000-1-git-send-email-reshma.pattan@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Cristian Dumitrescu
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Pattan, Reshma April 18, 2018, 4:58 p.m. UTC
  Using uninitialized value p.thread_id when calling kni_create.
Initialize the kni_params object to 0.

Coverity issue: 272569
Fixes: 9a408cc8ac ("examples/ip_pipeline: add KNI object")
CC: jasvinder.singh@intel.com

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
---
 examples/ip_pipeline/cli.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Jasvinder Singh April 19, 2018, 8:37 a.m. UTC | #1
> -----Original Message-----
> From: Pattan, Reshma
> Sent: Wednesday, April 18, 2018 5:58 PM
> To: dev@dpdk.org
> Cc: Singh, Jasvinder <jasvinder.singh@intel.com>; Pattan, Reshma
> <reshma.pattan@intel.com>
> Subject: [PATCH] examples/ip_pipeline: fixes uninitialized scalar variable
> 
> Using uninitialized value p.thread_id when calling kni_create.
> Initialize the kni_params object to 0.
> 
> Coverity issue: 272569
> Fixes: 9a408cc8ac ("examples/ip_pipeline: add KNI object")
> CC: jasvinder.singh@intel.com
> 
> Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
> ---
>  examples/ip_pipeline/cli.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c index
> 199a31ff8..575e176c1 100644
> --- a/examples/ip_pipeline/cli.c
> +++ b/examples/ip_pipeline/cli.c
> @@ -651,6 +651,7 @@ cmd_kni(char **tokens,
>  	char *name;
>  	struct kni *kni;
> 
> +	memset(&p, 0, sizeof(p));
>  	if ((n_tokens != 6) && (n_tokens != 8)) {
>  		snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
>  		return;
> --
> 2.14.3

Reviewed-by: Jasvinder Singh <jasvinder.singh@intel.com>
  

Patch

diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c
index 199a31ff8..575e176c1 100644
--- a/examples/ip_pipeline/cli.c
+++ b/examples/ip_pipeline/cli.c
@@ -651,6 +651,7 @@  cmd_kni(char **tokens,
 	char *name;
 	struct kni *kni;
 
+	memset(&p, 0, sizeof(p));
 	if ((n_tokens != 6) && (n_tokens != 8)) {
 		snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
 		return;