lkml.org 
[lkml]   [2020]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] dpaa2-mac: Fix potential null pointer dereference
Date
In dpaa2_pcs_destroy, variable pcs is dereference before it is
null-checked. Fix this.

Addresses-Coverity: CID 1497159: Null pointer dereferences (REVERSE_INULL)
Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
---
drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
index 6ff64dd1cf27..09bf4fec1172 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
@@ -291,11 +291,10 @@ static int dpaa2_pcs_create(struct dpaa2_mac *mac,
static void dpaa2_pcs_destroy(struct dpaa2_mac *mac)
{
struct lynx_pcs *pcs = mac->pcs;
- struct device *dev = &pcs->mdio->dev;

if (pcs) {
lynx_pcs_destroy(pcs);
- put_device(dev);
+ put_device(&pcs->mdio->dev);
mac->pcs = NULL;
}
}
--
2.28.0
\
 
 \ /
  Last update: 2020-09-27 15:32    [W:0.032 / U:2.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site