From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9D5C8A0579; Wed, 7 Apr 2021 16:57:23 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 25E68406A3; Wed, 7 Apr 2021 16:57:23 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id F3F734013F; Wed, 7 Apr 2021 16:57:20 +0200 (CEST) IronPort-SDR: Z7MsCegb+gZ/m+9Rda6yPeCWRB4yCPs/2O/L/LJJSuOh5lCJwcBlwAEnOEVXZ9HD/8ms5lVBY/ V+dZqbz7MfFg== X-IronPort-AV: E=McAfee;i="6000,8403,9947"; a="213716355" X-IronPort-AV: E=Sophos;i="5.82,203,1613462400"; d="scan'208";a="213716355" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Apr 2021 07:57:19 -0700 IronPort-SDR: Sgh9nUutHFdWifmLzl8P7khvOfySkLdtFVbv+fACqHjAsIxd8S0sG0bsHhGXsr6f4xojJJhKlE aFH4QnInwvKA== X-IronPort-AV: E=Sophos;i="5.82,203,1613462400"; d="scan'208";a="379849805" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.213.202.196]) ([10.213.202.196]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Apr 2021 07:57:18 -0700 To: Wei Huang , dev@dpdk.org, rosen.xu@intel.com, qi.z.zhang@intel.com Cc: stable@dpdk.org, tianfei.zhang@intel.com References: <1615969417-17118-1-git-send-email-wei.huang@intel.com> <1615969417-17118-2-git-send-email-wei.huang@intel.com> From: Ferruh Yigit X-User: ferruhy Message-ID: <6eb2400f-0edb-c9a5-d3ae-1881ae49efff@intel.com> Date: Wed, 7 Apr 2021 15:57:14 +0100 MIME-Version: 1.0 In-Reply-To: <1615969417-17118-2-git-send-email-wei.huang@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH v1 1/2] raw/ifpga/base: use untained variable as argument X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" On 3/17/2021 8:23 AM, Wei Huang wrote: > In fme_spi_init(), passing tainted expression "fme->max10_dev" > to function "intel_max10_device_remove" has risk. Untainted > variable "max10" should be used. > > Coverity issue: 367480 > Fixes: 96ebfcf8125c ("raw/ifpga/base: add SPI and MAX10 device driver") > Following is from the coverity: 2. tainted_return_value: Function intel_max10_device_probe returns tainted data. 3. var_assign: Assigning: max10 = intel_max10_device_probe(spi_master, 0), which taints max10 5. var_assign_var: Assigning: fme->max10_dev = max10. Both are now tainted. 'max10' is tainted at first place, and 'fme->max10_dev' is tainted because of 'max10'. In this case how replacing 'fme->max10_dev' with 'max10' helps? Did you verified that change is fixing the coverity issue? And as the previous one, what is the exact problem, what is tainted data and how it is a problem, can you please describe? > Signed-off-by: Wei Huang > --- > drivers/raw/ifpga/base/ifpga_fme.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/raw/ifpga/base/ifpga_fme.c b/drivers/raw/ifpga/base/ifpga_fme.c > index 43c7b9c3dc..a63f90331f 100644 > --- a/drivers/raw/ifpga/base/ifpga_fme.c > +++ b/drivers/raw/ifpga/base/ifpga_fme.c > @@ -1001,7 +1001,7 @@ static int fme_spi_init(struct ifpga_feature *feature) > return ret; > > max10_fail: > - intel_max10_device_remove(fme->max10_dev); > + intel_max10_device_remove(max10); > spi_fail: > altera_spi_release(spi_master); > return ret; >