From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 883F6A00BE; Mon, 27 Apr 2020 14:04:36 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1FBEE1C036; Mon, 27 Apr 2020 14:04:36 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 257661BF78 for ; Mon, 27 Apr 2020 14:04:35 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03RC0tr5015630 for ; Mon, 27 Apr 2020 05:04:34 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0818; bh=41uxXP5NJ5JNwQz4JsYaweYNUELmIp44WlkfI3RtC4A=; b=Cjs38KYizVLDuR4mFm5neDizhoWiy9tAo4/dqfOz+ertimGS0ZLRl+S3VQCOSOtj37+5 piXkfehEZgdrx5ZeDKtd3AFcN3lThsIXokfCxv693ML2lToA2ChKEh7ZwhsK3YHCfGc7 SjviXuRUqZHgrqPOIV7fsrDFQuBUizz93WtONwHjl3ODqigR9lCBuqcVrWVb7Y39azQh BvRZsmjHE4IBef3D4D+uewOmBO1PnRfav7Z3tp5YeWmrBqxICfIh9GDi/UVwRKPBoj9o XFN+p6a8aKHTlKIZsTFuGAVH7KQSX3JZZzbtyVcuW+5fKR9jh6pG4OikWwPBr8NX/MlZ Kw== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 30mmqmf16v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 27 Apr 2020 05:04:34 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 27 Apr 2020 05:04:32 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 27 Apr 2020 05:04:31 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 27 Apr 2020 05:04:31 -0700 Received: from localhost.localdomain (unknown [10.28.34.200]) by maili.marvell.com (Postfix) with ESMTP id 7D76A3F703F; Mon, 27 Apr 2020 05:04:30 -0700 (PDT) From: Sunil Kumar Kori To: Jerin Jacob , Sunil Kumar Kori CC: Date: Mon, 27 Apr 2020 17:34:24 +0530 Message-ID: <20200427120424.22728-1-skori@marvell.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-27_08:2020-04-24, 2020-04-27 signatures=0 Subject: [dpdk-dev] [PATCH] eal/trace: fix coverity issues X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "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 --- 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