From nobody Mon Apr 13 15:46:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE5CEC4332F for ; Tue, 15 Nov 2022 04:53:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232171AbiKOExr (ORCPT ); Mon, 14 Nov 2022 23:53:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232118AbiKOExo (ORCPT ); Mon, 14 Nov 2022 23:53:44 -0500 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F25A63D3; Mon, 14 Nov 2022 20:53:44 -0800 (PST) Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4NBDMj2Sc0z15MMt; Tue, 15 Nov 2022 12:53:21 +0800 (CST) Received: from kwepemm600005.china.huawei.com (7.193.23.191) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 15 Nov 2022 12:53:41 +0800 Received: from ubuntu1804.huawei.com (10.67.175.30) by kwepemm600005.china.huawei.com (7.193.23.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 15 Nov 2022 12:53:40 +0800 From: Hui Tang To: , , , , , , CC: , , Subject: [PATCH] net: mdio-ipq4019: fix possible invalid pointer dereference Date: Tue, 15 Nov 2022 12:50:28 +0800 Message-ID: <20221115045028.182441-1-tanghui20@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.67.175.30] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600005.china.huawei.com (7.193.23.191) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- 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-ipq401= 9.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 resou= rce 1 * is specified in the device tree. */ - if (priv->eth_ldo_rdy) { + if (!IS_ERR(priv->eth_ldo_rdy)) { val =3D readl(priv->eth_ldo_rdy); val |=3D BIT(0); writel(val, priv->eth_ldo_rdy); --=20 2.17.1