From: David Marchand Date: Thu, 30 Apr 2020 15:33:18 +0000 (+0200) Subject: trace: remove unneeded checks in internal API X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=d73b9f83cd432e77582e7f3b0517a9cbf75dd50f;p=dpdk.git trace: remove unneeded checks in internal API 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 Acked-by: Sunil Kumar Kori --- 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;