raw/ifpga/base: dereference before null check

Message ID 20190917222459.19097-1-tianfei.zhang@intel.com (mailing list archive)
State Accepted, archived
Delegated to: xiaolong ye
Headers
Series raw/ifpga/base: dereference before null check |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-dpdk_compile_ovs success Compile Testing PASS
ci/iol-dpdk_compile success Compile Testing PASS
ci/iol-dpdk_compile_spdk success Compile Testing PASS
ci/intel-Performance success Performance Testing PASS
ci/mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

Zhang, Tianfei Sept. 17, 2019, 10:24 p.m. UTC
  Add pointer null check before dereference.

Coverity issue: 344976
Fixes: 12f92a51 ("raw/ifpga/base: fix retimer link status")
Cc: stable@dpdk.org

Signed-off-by: Tianfei zhang <tianfei.zhang@intel.com>
---
 drivers/raw/ifpga/base/opae_eth_group.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
  

Comments

David Marchand Oct. 24, 2019, 7:22 p.m. UTC | #1
On Tue, Sep 17, 2019 at 4:38 PM Tianfei zhang <tianfei.zhang@intel.com> wrote:
>
> Add pointer null check before dereference.
>
> Coverity issue: 344976
> Fixes: 12f92a51 ("raw/ifpga/base: fix retimer link status")
> Cc: stable@dpdk.org
>
> Signed-off-by: Tianfei zhang <tianfei.zhang@intel.com>

This patch touches a "base driver" file, is this ok ?
  
Xu, Rosen Oct. 25, 2019, 1:05 a.m. UTC | #2
Hi,

> -----Original Message-----
> From: David Marchand [mailto:david.marchand@redhat.com]
> Sent: Friday, October 25, 2019 3:22
> To: Xu, Rosen <rosen.xu@intel.com>; Zhang, Tianfei
> <tianfei.zhang@intel.com>
> Cc: dev <dev@dpdk.org>; dpdk stable <stable@dpdk.org>
> Subject: Re: [dpdk-dev] [PATCH] raw/ifpga/base: dereference before null
> check
> 
> On Tue, Sep 17, 2019 at 4:38 PM Tianfei zhang <tianfei.zhang@intel.com>
> wrote:
> >
> > Add pointer null check before dereference.
> >
> > Coverity issue: 344976
> > Fixes: 12f92a51 ("raw/ifpga/base: fix retimer link status")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Tianfei zhang <tianfei.zhang@intel.com>
> 
> This patch touches a "base driver" file, is this ok ?

It's just raw/ifpga internal base driver.

> 
> --
> David Marchand
  
Xiaolong Ye Oct. 25, 2019, 2:40 a.m. UTC | #3
On 09/18, Tianfei zhang wrote:
>Add pointer null check before dereference.
>
>Coverity issue: 344976
>Fixes: 12f92a51 ("raw/ifpga/base: fix retimer link status")
>Cc: stable@dpdk.org
>
>Signed-off-by: Tianfei zhang <tianfei.zhang@intel.com>
>---
> drivers/raw/ifpga/base/opae_eth_group.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
>diff --git a/drivers/raw/ifpga/base/opae_eth_group.c b/drivers/raw/ifpga/base/opae_eth_group.c
>index d189dd578..be28954e0 100644
>--- a/drivers/raw/ifpga/base/opae_eth_group.c
>+++ b/drivers/raw/ifpga/base/opae_eth_group.c
>@@ -308,9 +308,8 @@ struct eth_group_device *eth_group_probe(void *base)
> 
> void eth_group_release(struct eth_group_device *dev)
> {
>-	eth_group_hw_uinit(dev);
>-
> 	if (dev) {
>+		eth_group_hw_uinit(dev);
> 		dev->status = ETH_GROUP_DEV_NOUSED;
> 		opae_free(dev);
> 	}
>-- 
>2.17.1
>

Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>

Applied to dpdk-next-net-intel. Thanks.
  
Ferruh Yigit Oct. 25, 2019, 10:29 a.m. UTC | #4
On 10/25/2019 3:40 AM, Ye Xiaolong wrote:
> On 09/18, Tianfei zhang wrote:
>> Add pointer null check before dereference.
>>
>> Coverity issue: 344976
>> Fixes: 12f92a51 ("raw/ifpga/base: fix retimer link status")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Tianfei zhang <tianfei.zhang@intel.com>
>> ---
>> drivers/raw/ifpga/base/opae_eth_group.c | 3 +--
>> 1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/raw/ifpga/base/opae_eth_group.c b/drivers/raw/ifpga/base/opae_eth_group.c
>> index d189dd578..be28954e0 100644
>> --- a/drivers/raw/ifpga/base/opae_eth_group.c
>> +++ b/drivers/raw/ifpga/base/opae_eth_group.c
>> @@ -308,9 +308,8 @@ struct eth_group_device *eth_group_probe(void *base)
>>
>> void eth_group_release(struct eth_group_device *dev)
>> {
>> -	eth_group_hw_uinit(dev);
>> -
>> 	if (dev) {
>> +		eth_group_hw_uinit(dev);
>> 		dev->status = ETH_GROUP_DEV_NOUSED;
>> 		opae_free(dev);
>> 	}
>> -- 
>> 2.17.1
>>
> 
> Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
> 
> Applied to dpdk-next-net-intel. Thanks.
> 

Should we update the MAINTAINERS file to say that "drivers/raw/ifpga" merges to
the next-net-intel?
  
David Marchand Oct. 25, 2019, 11:47 a.m. UTC | #5
On Fri, Oct 25, 2019 at 12:30 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> > Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
> >
> > Applied to dpdk-next-net-intel. Thanks.
> >
>
> Should we update the MAINTAINERS file to say that "drivers/raw/ifpga" merges to
> the next-net-intel?

Thanks, this area is, a bit, gray to me.
So a clarification is welcome.


--
David Marchand
  
Thomas Monjalon Oct. 25, 2019, 12:16 p.m. UTC | #6
25/10/2019 13:47, David Marchand:
> On Fri, Oct 25, 2019 at 12:30 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> > > Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
> > >
> > > Applied to dpdk-next-net-intel. Thanks.
> > >
> >
> > Should we update the MAINTAINERS file to say that "drivers/raw/ifpga" merges to
> > the next-net-intel?
> 
> Thanks, this area is, a bit, gray to me.
> So a clarification is welcome.

Yes I think it is OK to get raw/ifpga in next-net-intel.
  
Xiaolong Ye Oct. 28, 2019, 5:47 a.m. UTC | #7
On 10/25, Thomas Monjalon wrote:
>25/10/2019 13:47, David Marchand:
>> On Fri, Oct 25, 2019 at 12:30 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>> > > Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
>> > >
>> > > Applied to dpdk-next-net-intel. Thanks.
>> > >
>> >
>> > Should we update the MAINTAINERS file to say that "drivers/raw/ifpga" merges to
>> > the next-net-intel?
>> 
>> Thanks, this area is, a bit, gray to me.
>> So a clarification is welcome.
>
>Yes I think it is OK to get raw/ifpga in next-net-intel.
>
>

Done, just send a patch for it.

Thanks,
Xiaolong
  

Patch

diff --git a/drivers/raw/ifpga/base/opae_eth_group.c b/drivers/raw/ifpga/base/opae_eth_group.c
index d189dd578..be28954e0 100644
--- a/drivers/raw/ifpga/base/opae_eth_group.c
+++ b/drivers/raw/ifpga/base/opae_eth_group.c
@@ -308,9 +308,8 @@  struct eth_group_device *eth_group_probe(void *base)
 
 void eth_group_release(struct eth_group_device *dev)
 {
-	eth_group_hw_uinit(dev);
-
 	if (dev) {
+		eth_group_hw_uinit(dev);
 		dev->status = ETH_GROUP_DEV_NOUSED;
 		opae_free(dev);
 	}