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 D6A8BA04AF; Sun, 3 May 2020 22:33:01 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 75D0D1D537; Sun, 3 May 2020 22:32:28 +0200 (CEST) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by dpdk.org (Postfix) with ESMTP id 30E321D53B for ; Sun, 3 May 2020 22:32:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588537946; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+rW43JpaOcpWMyjQQFCSo4YYPHrBWPee2IW7LUwszhM=; b=MyebIqKcd3hUvbvg1MyZOPu0d9iXUcdJB08A/66FaDgtAmEeqYOod2iiJCEej4uswukZQ7 057wTyTAVu6UbcL9hxD0T/Sh/X8hL6Z/sXL7+WukIM1HF1HayUqxuhzwPNkjUv7dFjVU9j UAXPVNqrKgE4f28a42S0wBsn9JYllWI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-450-Jx-1qaXvOQy0IuHqqJnjjQ-1; Sun, 03 May 2020 16:32:23 -0400 X-MC-Unique: Jx-1qaXvOQy0IuHqqJnjjQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CBC1B800580; Sun, 3 May 2020 20:32:21 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.192.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 489AA5798D; Sun, 3 May 2020 20:32:19 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, Jerin Jacob , Sunil Kumar Kori Date: Sun, 3 May 2020 22:31:32 +0200 Message-Id: <20200503203135.6493-6-david.marchand@redhat.com> In-Reply-To: <20200503203135.6493-1-david.marchand@redhat.com> References: <20200503203135.6493-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Subject: [dpdk-dev] [PATCH 5/8] trace: remove unneeded checks in internal API 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" 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 --- 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_ea= l/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) =09struct trace *trace =3D trace_obj_get(); =09uint64_t bufsz; =20 -=09if (val =3D=3D NULL) { -=09=09trace_err("no optarg is passed"); -=09=09return -EINVAL; -=09} - =09bufsz =3D rte_str_to_size(val); =09if (bufsz =3D=3D 0) { =09=09trace_err("buffer size cannot be zero"); @@ -231,11 +226,6 @@ eal_trace_mode_args_save(const char *val) =09unsigned long tmp; =09char *pattern; =20 -=09if (val =3D=3D NULL) { -=09=09trace_err("no optarg is passed"); -=09=09return -EINVAL; -=09} - =09if (len =3D=3D 0) { =09=09trace_err("value is not provided with option"); =09=09return -EINVAL; @@ -271,11 +261,6 @@ eal_trace_dir_args_save(char const *val) =09char *dir_path =3D NULL; =09int rc; =20 -=09if (val =3D=3D NULL) { -=09=09trace_err("no optarg is passed"); -=09=09return -EINVAL; -=09} - =09if (strlen(val) >=3D size) { =09=09trace_err("input string is too big"); =09=09return -ENAMETOOLONG; --=20 2.23.0