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 D105CA00BE for ; Wed, 30 Oct 2019 08:52:42 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 906471BEF3; Wed, 30 Oct 2019 08:52:42 +0100 (CET) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 21FC21BED5 for ; Wed, 30 Oct 2019 08:52:39 +0100 (CET) Received: from mail-vk1-f200.google.com (mail-vk1-f200.google.com [209.85.221.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 512013D966 for ; Wed, 30 Oct 2019 07:52:38 +0000 (UTC) Received: by mail-vk1-f200.google.com with SMTP id g144so620286vkf.8 for ; Wed, 30 Oct 2019 00:52:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dPHNVGrIoW4Ilvk9MAyTRGPEBAEEdEL9NY98asXtrhg=; b=JmtyThMJ4Brm3AcrQZaWmcx5MnBXEIonguLauRCaFvpAbIRZfqreNnPUhqbnP03jwc 5Ud084IFjxYQJdGbtqZJ/jiVdiHzQLqsjyywFSgpXQbp95GSQkXmfutwMIh6FSzeshaG 8nGXlPnHPnpaUuDtGrpoPfn2WyZjKLRGFr+3Re+hCgNdInIB8Tmsx1MhmAluSCDEE2u+ AaXPRs4/lHr4bhbT8OG74DgoNivSZesJQqIKcscwhcaK59JJ/YcPH4Sjchx77o/IDT2v 34dvmRX2xODG3jjUsF+sZbso3Li1oyncba8l1jS6RSzeX4ThrdFP5Lz77HwROgeV5JES Um4w== X-Gm-Message-State: APjAAAVCSHZrUpGpHB77dfaMldlVR2H73UxcOv70zNK/0mYPg9+CgLdU DdN0BolIQtdrPAFkl2xIS1IU/qD0RvDg7TSR/ydhgxidpLoQBEXAlptmManXDCjq8nSwNdwVD+A aqZgjudOK+111H+4Oj0giDg4= X-Received: by 2002:a67:7d95:: with SMTP id y143mr4368344vsc.39.1572421957569; Wed, 30 Oct 2019 00:52:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqxay00n2kvr0yqiFfJtVplKy889NplEodZJQ3qF+iVKKWUMBdSUoLWhsf7wq/BYJ+9iZAGFOTD22JwKlaoldzo= X-Received: by 2002:a67:7d95:: with SMTP id y143mr4368333vsc.39.1572421957310; Wed, 30 Oct 2019 00:52:37 -0700 (PDT) MIME-Version: 1.0 References: <20191001125315.6191-1-ktraynor@redhat.com> <20191001125315.6191-2-ktraynor@redhat.com> In-Reply-To: <20191001125315.6191-2-ktraynor@redhat.com> From: David Marchand Date: Wed, 30 Oct 2019 08:52:25 +0100 Message-ID: To: Kevin Traynor Cc: dev , cian.ferriter@intel.com, dpdk stable Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH 1/9] net/pcap: fix argument checks X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On Tue, Oct 1, 2019 at 2:54 PM Kevin Traynor wrote: > > 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 This patch hides the coverity warning. But can't we just remove those checks? Iiuc, the checks on NULL pointers are unnecessary since https://git.dpdk.org/dpdk/commit/?id=a0fce1193ce13a50c00624cb36605ebef7a3e60b. -- David Marchand