Message ID | 20191106190203.10750-4-ktraynor@redhat.com (mailing list archive) |
---|---|
State | Accepted, archived |
Delegated to: | David Marchand |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id BE39FA04AB; Wed, 6 Nov 2019 20:02:52 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 675D41E8A5; Wed, 6 Nov 2019 20:02:35 +0100 (CET) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by dpdk.org (Postfix) with ESMTP id ADE051E86A for <dev@dpdk.org>; Wed, 6 Nov 2019 20:02:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573066951; 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=PodAppb9t0ih75//Q3LNZEsSmDpASGXw+Zdgt2BaX5k=; b=fZXYudlgXvUc7xJ0ySMj20efYmc4LTYkXhP+lIklmpWnB0S9WVR7P2ZmDdbWJvT1E2PGCI 3OsEIAaSQcAeCZ9wJBMYcxUCNIidD7/8AAss3e2BYOemoIgA3YmVwkxv8w/EMxrIunmEeZ MQ3H1I3lZscjVc0eQJrq2S7LO4qFB/U= 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-164-z9mKmBsKNQix023nCUTBTg-1; Wed, 06 Nov 2019 14:02:27 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 58D868017DD; Wed, 6 Nov 2019 19:02:26 +0000 (UTC) Received: from rh.redhat.com (unknown [10.36.118.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0484B1001B35; Wed, 6 Nov 2019 19:02:24 +0000 (UTC) From: Kevin Traynor <ktraynor@redhat.com> To: dev@dpdk.org Cc: david.marchand@redhat.com, Kevin Traynor <ktraynor@redhat.com>, rosen.xu@intel.com, stable@dpdk.org Date: Wed, 6 Nov 2019 19:01:58 +0000 Message-Id: <20191106190203.10750-4-ktraynor@redhat.com> In-Reply-To: <20191106190203.10750-1-ktraynor@redhat.com> References: <20191001125315.6191-1-ktraynor@redhat.com> <20191106190203.10750-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: z9mKmBsKNQix023nCUTBTg-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Subject: [dpdk-dev] [v2 PATCH 3/8] net/ipn3ke: fix incorrect commit check logic X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions <dev.dpdk.org> List-Unsubscribe: <https://mails.dpdk.org/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://mails.dpdk.org/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <https://mails.dpdk.org/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Series |
Coverity fixes and other cleanups
|
|
Checks
Context | Check | Description |
---|---|---|
ci/Intel-compilation | fail | apply issues |
Commit Message
Kevin Traynor
Nov. 6, 2019, 7:01 p.m. UTC
Coverity is complaining about identical code regardless of which branch
of the if else is taken. Functionally it means an error will always be
returned if this if else is hit. Remove the else branch.
CID 337928 (#1 of 1): Identical code for different branches
(IDENTICAL_BRANCHES)identical_branches: The same code is executed
regardless of whether n->level != IPN3KE_TM_NODE_LEVEL_COS ||
n->n_children != 0U is true, because the 'then' and 'else' branches
are identical. Should one of the branches be modified, or the entire
'if' statement replaced?
1506 if (n->level != IPN3KE_TM_NODE_LEVEL_COS ||
1507 n->n_children != 0) {
1508 return -rte_tm_error_set(error,
1509 EINVAL,
1510 RTE_TM_ERROR_TYPE_UNSPECIFIED,
1511 NULL,
1512 rte_strerror(EINVAL));
else_branch: The else branch, identical to the then branch.
1513 } else {
1514 return -rte_tm_error_set(error,
1515 EINVAL,
1516 RTE_TM_ERROR_TYPE_UNSPECIFIED,
1517 NULL,
1518 rte_strerror(EINVAL));
1519 }
Coverity issue: 337928
Fixes: c820468ac99c ("net/ipn3ke: support TM")
Cc: rosen.xu@intel.com
Cc: stable@dpdk.org
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
---
drivers/net/ipn3ke/ipn3ke_tm.c | 6 ------
1 file changed, 6 deletions(-)
Comments
Hi, > -----Original Message----- > From: Kevin Traynor [mailto:ktraynor@redhat.com] > Sent: Thursday, November 07, 2019 3:02 > To: dev@dpdk.org > Cc: david.marchand@redhat.com; Kevin Traynor <ktraynor@redhat.com>; > Xu, Rosen <rosen.xu@intel.com>; stable@dpdk.org > Subject: [v2 PATCH 3/8] net/ipn3ke: fix incorrect commit check logic > > Coverity is complaining about identical code regardless of which branch of > the if else is taken. Functionally it means an error will always be returned if > this if else is hit. Remove the else branch. > > CID 337928 (#1 of 1): Identical code for different branches > (IDENTICAL_BRANCHES)identical_branches: The same code is executed > regardless of whether n->level != IPN3KE_TM_NODE_LEVEL_COS || > n->n_children != 0U is true, because the 'then' and 'else' branches > are identical. Should one of the branches be modified, or the entire > 'if' statement replaced? > 1506 if (n->level != IPN3KE_TM_NODE_LEVEL_COS || > 1507 n->n_children != 0) { > 1508 return -rte_tm_error_set(error, > 1509 EINVAL, > 1510 RTE_TM_ERROR_TYPE_UNSPECIFIED, > 1511 NULL, > 1512 rte_strerror(EINVAL)); > else_branch: The else branch, identical to the then branch. > 1513 } else { > 1514 return -rte_tm_error_set(error, > 1515 EINVAL, > 1516 RTE_TM_ERROR_TYPE_UNSPECIFIED, > 1517 NULL, > 1518 rte_strerror(EINVAL)); > 1519 } > > Coverity issue: 337928 > Fixes: c820468ac99c ("net/ipn3ke: support TM") > Cc: rosen.xu@intel.com > Cc: stable@dpdk.org > > Signed-off-by: Kevin Traynor <ktraynor@redhat.com> > --- > drivers/net/ipn3ke/ipn3ke_tm.c | 6 ------ > 1 file changed, 6 deletions(-) > > diff --git a/drivers/net/ipn3ke/ipn3ke_tm.c > b/drivers/net/ipn3ke/ipn3ke_tm.c index adf02c157..a93145d59 100644 > --- a/drivers/net/ipn3ke/ipn3ke_tm.c > +++ b/drivers/net/ipn3ke/ipn3ke_tm.c > @@ -1511,10 +1511,4 @@ ipn3ke_tm_hierarchy_commit_check(struct > rte_eth_dev *dev, > NULL, > rte_strerror(EINVAL)); > - } else { > - return -rte_tm_error_set(error, > - EINVAL, > - > RTE_TM_ERROR_TYPE_UNSPECIFIED, > - NULL, > - rte_strerror(EINVAL)); > } > } > -- > 2.21.0 Reviewed-by: Rosen Xu <rosen.xu@intel.com>
diff --git a/drivers/net/ipn3ke/ipn3ke_tm.c b/drivers/net/ipn3ke/ipn3ke_tm.c index adf02c157..a93145d59 100644 --- a/drivers/net/ipn3ke/ipn3ke_tm.c +++ b/drivers/net/ipn3ke/ipn3ke_tm.c @@ -1511,10 +1511,4 @@ ipn3ke_tm_hierarchy_commit_check(struct rte_eth_dev *dev, NULL, rte_strerror(EINVAL)); - } else { - return -rte_tm_error_set(error, - EINVAL, - RTE_TM_ERROR_TYPE_UNSPECIFIED, - NULL, - rte_strerror(EINVAL)); } }