lkml.org 
[lkml]   [2019]   [Mar]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] net: stmmac: fix a potential NULL pointer dereference
From
Date

On 3/12/2019 1:02 PM, Kangjie Lu wrote:
> In case of_device_get_match_data fails, the fix return -ENOMEM

s/-ENOMEM/-EINVAL


Otherwise looks good to me.
Make the above correction.
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>

-Mukesh

> to avoid the NULL pointer dereference.
>
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
> ---
> 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;
>
> err = stmmac_dvr_remove(&pdev->dev);
> if (err < 0)

\
 
 \ /
  Last update: 2019-03-27 14:43    [W:0.057 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site