[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140815131026.GA17800@lunn.ch>
Date: Fri, 15 Aug 2014 15:10:26 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Peter Griffin <peter.griffin@...aro.org>
Cc: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
kishon@...com, kgene.kim@...sung.com,
maxime.ripard@...e-electrons.com,
linux-samsung-soc@...r.kernel.org, lee.jones@...aro.org,
patches@...aro.org
Subject: Re: [PATCH 2/9] phy: phy-mvebu-sata: Add missing error check for
devm_kzalloc
On Fri, Aug 15, 2014 at 01:40:09PM +0100, Peter Griffin wrote:
> Currently this driver is missing a check on the return value of devm_kzalloc,
> which would cause a NULL pointer dereference in a OOM situation.
>
> This patch adds the aformentioned missing check.
>
> Signed-off-by: Peter Griffin <peter.griffin@...aro.org>
Acked-by: Andrew Lunn <andrew@...n.ch>
Thanks
Andrew
> ---
> drivers/phy/phy-mvebu-sata.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/phy/phy-mvebu-sata.c b/drivers/phy/phy-mvebu-sata.c
> index cc3c0e1..10bb8e5 100644
> --- a/drivers/phy/phy-mvebu-sata.c
> +++ b/drivers/phy/phy-mvebu-sata.c
> @@ -89,6 +89,8 @@ static int phy_mvebu_sata_probe(struct platform_device *pdev)
> struct phy *phy;
>
> priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> + if (!priv)
> + return -ENOMEM;
>
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> priv->base = devm_ioremap_resource(&pdev->dev, res);
> --
> 1.9.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@...ts.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists