<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p><br>
</p>
<div class="moz-cite-prefix">On 3/23/2019 9:09 AM, Kangjie Lu wrote:<br>
</div>
<blockquote type="cite"
cite="mid:20190323033942.21796-1-kjlu@umn.edu">
<pre class="moz-quote-pre" wrap="">In case of_device_get_match_data fails, the fix return -EINVAL
to avoid the NULL pointer dereference.
Signed-off-by: Kangjie Lu <a class="moz-txt-link-rfc2396E" href="mailto:kjlu@umn.edu"><kjlu@umn.edu></a>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
index 3256e5cbad27..344ead5949b1 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
@@ -485,6 +485,8 @@ static int dwc_eth_dwmac_remove(struct platform_device *pdev)
int err;
data = of_device_get_match_data(&pdev->dev);
+ if (!data)
+ return -EINVAL;</pre>
</blockquote>
<p>Although, it is false alarm for this driver as of_match_table is
not NULL, but it would be good to add the check.</p>
<p>
Reviewed-by: Mukesh Ojha <<a href="mailto:mojha@codeaurora.org"
title="mojha@codeaurora.org" class="mailto">mojha@codeaurora.org</a>>
</p>
<p>
Thanks.<br>
Mukesh
</p>
<p><br>
</p>
<p><br>
</p>
<blockquote type="cite"
cite="mid:20190323033942.21796-1-kjlu@umn.edu">
<pre class="moz-quote-pre" wrap="">
err = stmmac_dvr_remove(&pdev->dev);
if (err < 0)
</pre>
</blockquote>
</body>
</html>