[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221115045028.182441-1-tanghui20@huawei.com>
Date: Tue, 15 Nov 2022 12:50:28 +0800
From: Hui Tang <tanghui20@...wei.com>
To: <davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
<mw@...ihalf.com>, <linux@...linux.org.uk>, <andrew@...n.ch>,
<pabeni@...hat.com>
CC: <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<yusongping@...wei.com>
Subject: [PATCH] net: mdio-ipq4019: fix possible invalid pointer dereference
priv->eth_ldo_rdy is saved the return value of devm_ioremap_resource(),
which !IS_ERR() should be used to check.
Fixes: 23a890d493e3 ("net: mdio: Add the reset function for IPQ MDIO driver")
Signed-off-by: Hui Tang <tanghui20@...wei.com>
---
drivers/net/mdio/mdio-ipq4019.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/mdio/mdio-ipq4019.c b/drivers/net/mdio/mdio-ipq4019.c
index 4eba5a91075c..d7a1f7c56f97 100644
--- a/drivers/net/mdio/mdio-ipq4019.c
+++ b/drivers/net/mdio/mdio-ipq4019.c
@@ -188,7 +188,7 @@ static int ipq_mdio_reset(struct mii_bus *bus)
/* To indicate CMN_PLL that ethernet_ldo has been ready if platform resource 1
* is specified in the device tree.
*/
- if (priv->eth_ldo_rdy) {
+ if (!IS_ERR(priv->eth_ldo_rdy)) {
val = readl(priv->eth_ldo_rdy);
val |= BIT(0);
writel(val, priv->eth_ldo_rdy);
--
2.17.1
Powered by blists - more mailing lists