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 C3CFCA04AB; Wed, 6 Nov 2019 20:02:30 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 660411E864; Wed, 6 Nov 2019 20:02:29 +0100 (CET) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by dpdk.org (Postfix) with ESMTP id DE2141C132 for ; Wed, 6 Nov 2019 20:02:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573066947; 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=yEKdgmUoUl4BQhC+B/j5hHn9giIsWK98vcI2EftlhLE=; b=C3bC5LJalWrnoisFl88Ti9fHVmsOlhzA/v5NknK0rIxhsa34n5D7qwGyv2hJBk6+iNrW2n Rfz+F2I8EqGRWKbIDFLVhcKyjXiTYBVDksFGEIYgess5SLOF4xHQUAPhm5rR5fbUvolXf1 +q/PbfdLWgpOMlke11wK7wXRfPu90WQ= 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-103-aGnCF9S4NXCaBiwklx07GQ-1; Wed, 06 Nov 2019 14:02:24 -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 0C3431800D6B; Wed, 6 Nov 2019 19:02:23 +0000 (UTC) Received: from rh.redhat.com (unknown [10.36.118.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9B4D11001B35; Wed, 6 Nov 2019 19:02:21 +0000 (UTC) From: Kevin Traynor To: dev@dpdk.org Cc: david.marchand@redhat.com, Kevin Traynor , stable@dpdk.org, Cian Ferriter Date: Wed, 6 Nov 2019 19:01:56 +0000 Message-Id: <20191106190203.10750-2-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: aGnCF9S4NXCaBiwklx07GQ-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Subject: [dpdk-dev] [v2 PATCH 1/8] net/pcap: fix argument checks 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" Previously rx/tx_queues were passed into eth_from_pcaps_common() as ptrs and were checked for being NULL. In commit da6ba28f0540 ("net/pcap: use a struct to pass user options") that changed to pass in a ptr to a pmd_devargs_all which contains the rx/tx_queues. The parameter checking was not updated as part of that commit and coverity caught that there was still a check if rx/tx_queues were NULL, apparently after they had been dereferenced. In fact as they are a members of the devargs_all struct, they will not be NULL so remove those checks. 1231 struct pmd_devargs *rx_queues =3D &devargs_all->rx_queues; 1232 struct pmd_devargs *tx_queues =3D &devargs_all->tx_queues; 1233 const unsigned int nb_rx_queues =3D rx_queues->num_of_queue; deref_ptr: Directly dereferencing pointer tx_queues. 1234 const unsigned int nb_tx_queues =3D tx_queues->num_of_queue; 1235 unsigned int i; 1236 1237 /* do some parameter checking */ CID 345004: Dereference before null check (REVERSE_INULL) [select issue] 1238 if (rx_queues =3D=3D NULL && nb_rx_queues > 0) 1239 return -1; CID 345029 (#1 of 1): Dereference before null check (REVERSE_INULL) check_after_deref: Null-checking tx_queues suggests that it may be null, but it has already been dereferenced on all paths leading to the check. 1240 if (tx_queues =3D=3D NULL && nb_tx_queues > 0) 1241 return -1; Coverity issue: 345029 Coverity issue: 345044 Fixes: da6ba28f0540 ("net/pcap: use a struct to pass user options") Cc: stable@dpdk.org Signed-off-by: Kevin Traynor Acked-by: Cian Ferriter --- drivers/net/pcap/rte_eth_pcap.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pca= p.c index 5186d8fe5..aa7ef6fdb 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -1241,10 +1241,4 @@ eth_from_pcaps_common(struct rte_vdev_device *vdev, =09unsigned int i; =20 -=09/* do some parameter checking */ -=09if (rx_queues =3D=3D NULL && nb_rx_queues > 0) -=09=09return -1; -=09if (tx_queues =3D=3D NULL && nb_tx_queues > 0) -=09=09return -1; - =09if (pmd_init_internals(vdev, nb_rx_queues, nb_tx_queues, internals, =09=09=09eth_dev) < 0) --=20 2.21.0