From: Kangjie Lu <kjlu@umn.edu>
To: kjlu@umn.edu
Cc: pakki001@umn.edu,
Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
"David S. Miller" <davem@davemloft.net>,
Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Vladimir Barinov <vladimir.barinov@cogentembedded.com>,
Chris Brandt <chris.brandt@renesas.com>,
netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] net: renesas: fix a potential NULL pointer dereference
Date: Mon, 11 Mar 2019 02:01:36 -0500 [thread overview]
Message-ID: <20190311070138.24084-1-kjlu@umn.edu> (raw)
In case of_get_phy_mode fails, the fix returns NULL to avoid
the NULL pointer dereference.
Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
drivers/net/ethernet/renesas/sh_eth.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 339b2eae2100..b119587ec673 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -3187,6 +3187,8 @@ static struct sh_eth_plat_data *sh_eth_parse_dt(struct device *dev)
return NULL;
pdata->phy_interface = of_get_phy_mode(np);
+ if (unlikely(!pdata->phy_interface))
+ return NULL;
mac_addr = of_get_mac_address(np);
if (mac_addr)
--
2.17.1
next reply other threads:[~2019-03-11 7:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-11 7:01 Kangjie Lu [this message]
2019-03-11 7:43 ` Geert Uytterhoeven
2019-03-11 10:43 ` Sergei Shtylyov
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=20190311070138.24084-1-kjlu@umn.edu \
--to=kjlu@umn.edu \
--cc=chris.brandt@renesas.com \
--cc=davem@davemloft.net \
--cc=geert+renesas@glider.be \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pakki001@umn.edu \
--cc=sergei.shtylyov@cogentembedded.com \
--cc=vladimir.barinov@cogentembedded.com \
--cc=vladimir_zapolskiy@mentor.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
all inboxes | Powered by JetHome®