DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] eal/trace: fix coverity issues
@ 2020-04-27 12:04 Sunil Kumar Kori
  2020-04-27 12:26 ` David Marchand
  0 siblings, 1 reply; 6+ messages in thread
From: Sunil Kumar Kori @ 2020-04-27 12:04 UTC (permalink / raw)
  To: Jerin Jacob, Sunil Kumar Kori; +Cc: dev

Pointer was being dereferenced without NULL checking.

Coverity issue: 357768

Fixes: 8c8066ea6a7b ("trace: add trace mode configuration parameter")

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
---
 lib/librte_eal/common/eal_common_trace_utils.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/common/eal_common_trace_utils.c b/lib/librte_eal/common/eal_common_trace_utils.c
index fce8892c3..119e97119 100644
--- a/lib/librte_eal/common/eal_common_trace_utils.c
+++ b/lib/librte_eal/common/eal_common_trace_utils.c
@@ -227,15 +227,16 @@ int
 eal_trace_mode_args_save(const char *optarg)
 {
 	struct trace *trace = trace_obj_get();
-	size_t len = strlen(optarg);
 	unsigned long tmp;
 	char *pattern;
+	size_t len;
 
 	if (optarg == NULL) {
 		trace_err("no optarg is passed");
 		return -EINVAL;
 	}
 
+	len = strlen(optarg);
 	if (len == 0) {
 		trace_err("value is not provided with option");
 		return -EINVAL;
-- 
2.17.1


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

end of thread, other threads:[~2020-04-30 13:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-27 12:04 [dpdk-dev] [PATCH] eal/trace: fix coverity issues Sunil Kumar Kori
2020-04-27 12:26 ` David Marchand
2020-04-27 13:46   ` [dpdk-dev] [EXT] " Sunil Kumar Kori
2020-04-27 13:52     ` David Marchand
2020-04-27 14:00       ` Sunil Kumar Kori
2020-04-30 13:59       ` Sunil Kumar Kori

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).