patches for DPDK stable branches
 help / color / Atom feed
From: "Ferriter, Cian" <cian.ferriter@intel.com>
To: Kevin Traynor <ktraynor@redhat.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-stable] [PATCH 1/9] net/pcap: fix argument checks
Date: Fri, 4 Oct 2019 10:57:17 +0000
Message-ID: <579B86492DFB364BBA627A48FB30C90E75DD9ADB@IRSMSX102.ger.corp.intel.com> (raw)
In-Reply-To: <20191001125315.6191-2-ktraynor@redhat.com>

 

> -----Original Message-----
> From: Kevin Traynor [mailto:ktraynor@redhat.com]
> Sent: Tuesday 1 October 2019 13:53
> To: dev@dpdk.org
> Cc: Kevin Traynor <ktraynor@redhat.com>; Ferriter, Cian
> <cian.ferriter@intel.com>; stable@dpdk.org
> Subject: [PATCH 1/9] net/pcap: fix argument checks
> 
> 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.
> 
> Fix that by checking the pmd_devargs_all ptr and removing the NULL checks
> on rx/tx_queues.
> 
> 1231        struct pmd_devargs *rx_queues = &devargs_all->rx_queues;
> 1232        struct pmd_devargs *tx_queues = &devargs_all->tx_queues;
> 1233        const unsigned int nb_rx_queues = rx_queues->num_of_queue;
>     deref_ptr: Directly dereferencing pointer tx_queues.
> 1234        const unsigned int nb_tx_queues = 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 == 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 == 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: cian.ferriter@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Kevin Traynor <ktraynor@redhat.com>

Acked-by: Cian Ferriter <cian.ferriter@intel.com>


> ---
>  drivers/net/pcap/rte_eth_pcap.c | 19 +++++++++++--------
>  1 file changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/pcap/rte_eth_pcap.c
> b/drivers/net/pcap/rte_eth_pcap.c index 5489010b6..7cf00306e 100644
> --- a/drivers/net/pcap/rte_eth_pcap.c
> +++ b/drivers/net/pcap/rte_eth_pcap.c
> @@ -1229,16 +1229,19 @@ eth_from_pcaps_common(struct
> rte_vdev_device *vdev,  {
>  	struct pmd_process_private *pp;
> -	struct pmd_devargs *rx_queues = &devargs_all->rx_queues;
> -	struct pmd_devargs *tx_queues = &devargs_all->tx_queues;
> -	const unsigned int nb_rx_queues = rx_queues->num_of_queue;
> -	const unsigned int nb_tx_queues = tx_queues->num_of_queue;
> +	struct pmd_devargs *rx_queues;
> +	struct pmd_devargs *tx_queues;
> +	unsigned int nb_rx_queues;
> +	unsigned int nb_tx_queues;
>  	unsigned int i;
> 
> -	/* do some parameter checking */
> -	if (rx_queues == NULL && nb_rx_queues > 0)
> -		return -1;
> -	if (tx_queues == NULL && nb_tx_queues > 0)
> +	if (devargs_all == NULL)
>  		return -1;
> 
> +	rx_queues = &devargs_all->rx_queues;
> +	tx_queues = &devargs_all->tx_queues;
> +
> +	nb_rx_queues = rx_queues->num_of_queue;
> +	nb_tx_queues = tx_queues->num_of_queue;
> +
>  	if (pmd_init_internals(vdev, nb_rx_queues, nb_tx_queues,
> internals,
>  			eth_dev) < 0)
> --
> 2.21.0


  reply index

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20191001125315.6191-1-ktraynor@redhat.com>
2019-10-01 12:53 ` Kevin Traynor
2019-10-04 10:57   ` Ferriter, Cian [this message]
2019-10-30  7:52   ` [dpdk-stable] [dpdk-dev] " David Marchand
2019-11-05 16:40     ` Kevin Traynor
2019-11-05 17:10       ` Ferriter, Cian
2019-11-06 19:03         ` Kevin Traynor
2019-10-01 13:03 ` [dpdk-stable] [PATCH 2/9] crypto/octeontx: fix possible NULL deference Kevin Traynor
2019-10-01 13:03   ` [dpdk-stable] [PATCH 3/9] net/bnxt: remove logically dead code Kevin Traynor
2019-10-02  1:28     ` [dpdk-stable] [dpdk-dev] " Ajit Khaparde
2019-10-30  7:43       ` David Marchand
2019-10-30 16:27         ` Ajit Khaparde
2019-11-05 15:39           ` Kevin Traynor
2019-10-01 13:04   ` [dpdk-stable] [PATCH 4/9] net/ipn3ke: fix incorrect commit check logic Kevin Traynor
2019-10-30  7:59     ` [dpdk-stable] [dpdk-dev] " David Marchand
2019-11-05 15:41       ` Kevin Traynor
2019-11-08 14:45         ` Xu, Rosen
2019-11-08 14:47           ` Kevin Traynor
2019-11-08 14:35       ` Xu, Rosen
2019-11-08 14:52     ` [dpdk-stable] " Xu, Rosen
2019-10-01 13:04   ` [dpdk-stable] [PATCH 5/9] net/ipn3ke: remove useless if statement Kevin Traynor
2019-10-30  8:01     ` David Marchand
2019-11-08 14:35       ` Xu, Rosen
2019-11-08 14:52     ` Xu, Rosen
2019-10-01 13:04   ` [dpdk-stable] [PATCH 6/9] net/ipn3ke: remove commented out code Kevin Traynor
2019-10-30  8:04     ` David Marchand
2019-11-08 14:40       ` Xu, Rosen
2019-11-08 14:51     ` Xu, Rosen
2019-10-01 13:04   ` [dpdk-stable] [PATCH 7/9] compress/octeontx: " Kevin Traynor
2019-10-30  8:06     ` [dpdk-stable] [dpdk-dev] " David Marchand
2019-10-01 13:04   ` [dpdk-stable] [PATCH 8/9] event/opdl: " Kevin Traynor
2019-10-03 10:50     ` Liang, Ma
2019-10-01 13:04   ` [dpdk-stable] [PATCH 9/9] net/bnxt: " Kevin Traynor
2019-10-01 15:42     ` Ajit Khaparde
2019-10-30  7:56   ` [dpdk-stable] [PATCH 2/9] crypto/octeontx: fix possible NULL deference David Marchand
     [not found] ` <20191106190203.10750-1-ktraynor@redhat.com>
2019-11-06 19:01   ` [dpdk-stable] [v2 PATCH 1/8] net/pcap: fix argument checks Kevin Traynor
2019-11-06 19:01   ` [dpdk-stable] [v2 PATCH 2/8] common/cpt: fix possible NULL deference Kevin Traynor
2019-11-06 19:01   ` [dpdk-stable] [v2 PATCH 3/8] net/ipn3ke: fix incorrect commit check logic Kevin Traynor
2019-11-08 14:50     ` Xu, Rosen
2019-11-06 19:01   ` [dpdk-stable] [v2 PATCH 4/8] net/ipn3ke: remove useless if statement Kevin Traynor
2019-11-08 14:49     ` Xu, Rosen
2019-11-06 19:02   ` [dpdk-stable] [v2 PATCH 5/8] net/ipn3ke: remove commented out code Kevin Traynor
2019-11-08 14:50     ` Xu, Rosen
2019-11-06 19:02   ` [dpdk-stable] [v2 PATCH 6/8] compress/octeontx: " Kevin Traynor
2019-11-06 19:02   ` [dpdk-stable] [v2 PATCH 7/8] event/opdl: " Kevin Traynor
2019-11-06 19:02   ` [dpdk-stable] [v2 PATCH 8/8] net/bnxt: " Kevin Traynor

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=579B86492DFB364BBA627A48FB30C90E75DD9ADB@IRSMSX102.ger.corp.intel.com \
    --to=cian.ferriter@intel.com \
    --cc=dev@dpdk.org \
    --cc=ktraynor@redhat.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

patches for DPDK stable branches

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/ public-inbox