From: Alex Dewar <alex.dewar90@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Alex Dewar <alex.dewar90@gmail.com>,
Ioana Ciornei <ioana.ciornei@nxp.com>,
Ioana Radulescu <ruxandra.radulescu@nxp.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] dpaa2-mac: Fix potential null pointer dereference
Date: Sun, 27 Sep 2020 14:31:20 +0100 [thread overview]
Message-ID: <20200927133119.586083-1-alex.dewar90@gmail.com> (raw)
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
next reply other threads:[~2020-09-27 13:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-27 13:31 Alex Dewar [this message]
2020-09-27 13:59 ` [PATCH] dpaa2-mac: Fix potential null pointer dereference Ioana Ciornei
Reply instructions:
You may reply publicly 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=20200927133119.586083-1-alex.dewar90@gmail.com \
--to=alex.dewar90@gmail.com \
--cc=davem@davemloft.net \
--cc=ioana.ciornei@nxp.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=ruxandra.radulescu@nxp.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).