[dpdk-dev] [PATCH 5/8] trace: remove unneeded checks in internal API
David Marchand
david.marchand at redhat.com
Sun May 3 22:31:32 CEST 2020
The trace framework can be configured via 4 EAL options:
- --trace which calls eal_trace_args_save,
- --trace-dir which calls eal_trace_dir_args_save,
- --trace-bufsz which calls eal_trace_bufsz_args_save,
- --trace-mode which calls eal_trace_mode_args_save.
Those 4 internal callbacks are getting passed a non NULL value:
optarg won't be NULL since those options are declared with
required_argument (man getopt_long).
eal_trace_bufsz_args_save() already trusted passed value, align the other
3 internal callbacks.
Coverity issue: 357768
Fixes: 8c8066ea6a7b ("trace: add trace mode configuration parameter")
Signed-off-by: David Marchand <david.marchand at redhat.com>
---
lib/librte_eal/common/eal_common_trace_utils.c | 15 ---------------
1 file changed, 15 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_trace_utils.c b/lib/librte_eal/common/eal_common_trace_utils.c
index a7c5893b00..4077acf428 100644
--- a/lib/librte_eal/common/eal_common_trace_utils.c
+++ b/lib/librte_eal/common/eal_common_trace_utils.c
@@ -199,11 +199,6 @@ eal_trace_bufsz_args_save(char const *val)
struct trace *trace = trace_obj_get();
uint64_t bufsz;
- if (val == NULL) {
- trace_err("no optarg is passed");
- return -EINVAL;
- }
-
bufsz = rte_str_to_size(val);
if (bufsz == 0) {
trace_err("buffer size cannot be zero");
@@ -231,11 +226,6 @@ eal_trace_mode_args_save(const char *val)
unsigned long tmp;
char *pattern;
- if (val == NULL) {
- trace_err("no optarg is passed");
- return -EINVAL;
- }
-
if (len == 0) {
trace_err("value is not provided with option");
return -EINVAL;
@@ -271,11 +261,6 @@ eal_trace_dir_args_save(char const *val)
char *dir_path = NULL;
int rc;
- if (val == NULL) {
- trace_err("no optarg is passed");
- return -EINVAL;
- }
-
if (strlen(val) >= size) {
trace_err("input string is too big");
return -ENAMETOOLONG;
--
2.23.0
More information about the dev
mailing list