From: Jasvinder Singh <jasvinder.singh@intel.com>
To: dev@dpdk.org
Cc: cristian.dumitrescu@intel.com
Subject: [dpdk-dev] [PATCH] examples/ip_pipeline: fix null pointer deref
Date: Fri, 9 Nov 2018 16:12:25 +0000 [thread overview]
Message-ID: <20181109161225.91417-1-jasvinder.singh@intel.com> (raw)
Fixes null pointer dereference issue raised by coverity.
Coverity issue: 325728, 325729, 325731, 325738
Fixes: 27b333b23237 ("examples/ip_pipeline: track table rules on add bulk")
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
---
examples/ip_pipeline/cli.c | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c
index 3de620682..910386282 100644
--- a/examples/ip_pipeline/cli.c
+++ b/examples/ip_pipeline/cli.c
@@ -6841,20 +6841,26 @@ cli_rule_file_process(const char *file_name,
return 0;
cli_rule_file_process_free:
- *rule_list = NULL;
- *n_rules = rule_id;
- *line_number = line_id;
+ if (rule_list != NULL)
+ *rule_list = NULL;
- for ( ; ; ) {
- struct table_rule *rule;
+ if (n_rules != NULL)
+ *n_rules = rule_id;
- rule = TAILQ_FIRST(list);
- if (rule == NULL)
- break;
+ if (line_number != NULL)
+ *line_number = line_id;
- TAILQ_REMOVE(list, rule, node);
- free(rule);
- }
+ if (list != NULL)
+ for ( ; ; ) {
+ struct table_rule *rule;
+
+ rule = TAILQ_FIRST(list);
+ if (rule == NULL)
+ break;
+
+ TAILQ_REMOVE(list, rule, node);
+ free(rule);
+ }
if (f)
fclose(f);
--
2.17.1
next reply other threads:[~2018-11-09 16:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-09 16:12 Jasvinder Singh [this message]
2018-11-09 16:58 ` Dumitrescu, Cristian
2018-11-12 16:43 ` Dumitrescu, Cristian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181109161225.91417-1-jasvinder.singh@intel.com \
--to=jasvinder.singh@intel.com \
--cc=cristian.dumitrescu@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).