All of lore.kernel.org
 help / color / mirror / Atom feed
From: sboyd@codeaurora.org (Stephen Boyd)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] clk: Do not dereference potential NULL pointer
Date: Thu, 31 Oct 2013 10:12:32 -0700	[thread overview]
Message-ID: <52728F80.8080203@codeaurora.org> (raw)
In-Reply-To: <1383221036-26890-1-git-send-email-treding@nvidia.com>

On 10/31/13 05:03, Thierry Reding wrote:
> A NULL pointer may be passed to _clk_register() for the dev parameter
> (via clk_register()). Make sure not to dereference it before checking
> that it's valid.
>
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---

Ugh I had this fixed but didn't send it.

Acked-by: Stephen Boyd <sboyd@codeaurora.org>

>  drivers/clk/clk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index b68a999..c0b52e3 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -1976,7 +1976,7 @@ static int _clk_register(struct device *dev, struct clk_hw *hw, struct clk *clk)
>  		hw->regmap = hw->init->regmap;
>  	else if (dev && dev_get_regmap(dev, NULL))
>  		hw->regmap = dev_get_regmap(dev, NULL);
> -	else if (dev->parent)
> +	else if (dev && dev->parent)
>  		hw->regmap = dev_get_regmap(dev->parent, NULL);
>  
>  	/* allocate local copy in case parent_names is __initdata */


-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

  reply	other threads:[~2013-10-31 17:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-31 12:03 [PATCH] clk: Do not dereference potential NULL pointer Thierry Reding
2013-10-31 17:12 ` Stephen Boyd [this message]
2013-10-31 18:22 ` Mike Turquette
2013-11-01  9:13   ` Thierry Reding

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=52728F80.8080203@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.