* [PATCH] clk: Do not dereference potential NULL pointer
@ 2013-10-31 12:03 Thierry Reding
2013-10-31 17:12 ` Stephen Boyd
2013-10-31 18:22 ` Mike Turquette
0 siblings, 2 replies; 4+ messages in thread
From: Thierry Reding @ 2013-10-31 12:03 UTC (permalink / raw)
To: linux-arm-kernel
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>
---
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 */
--
1.8.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] clk: Do not dereference potential NULL pointer
2013-10-31 12:03 [PATCH] clk: Do not dereference potential NULL pointer Thierry Reding
@ 2013-10-31 17:12 ` Stephen Boyd
2013-10-31 18:22 ` Mike Turquette
1 sibling, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2013-10-31 17:12 UTC (permalink / raw)
To: linux-arm-kernel
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] clk: Do not dereference potential NULL pointer
2013-10-31 12:03 [PATCH] clk: Do not dereference potential NULL pointer Thierry Reding
2013-10-31 17:12 ` Stephen Boyd
@ 2013-10-31 18:22 ` Mike Turquette
2013-11-01 9:13 ` Thierry Reding
1 sibling, 1 reply; 4+ messages in thread
From: Mike Turquette @ 2013-10-31 18:22 UTC (permalink / raw)
To: linux-arm-kernel
Quoting Thierry Reding (2013-10-31 05:03:56)
> 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>
Hi Thierry,
I saw Olof's fix first so I took that and applied your Ack.
Regards,
Mike
> ---
> 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 */
> --
> 1.8.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] clk: Do not dereference potential NULL pointer
2013-10-31 18:22 ` Mike Turquette
@ 2013-11-01 9:13 ` Thierry Reding
0 siblings, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2013-11-01 9:13 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Oct 31, 2013 at 11:22:33AM -0700, Mike Turquette wrote:
> Quoting Thierry Reding (2013-10-31 05:03:56)
> > 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>
>
> Hi Thierry,
>
> I saw Olof's fix first so I took that and applied your Ack.
Perhaps we need a new kind of tag. Something like Also-by: =)
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131101/b86181ce/attachment.sig>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-11-01 9:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-31 12:03 [PATCH] clk: Do not dereference potential NULL pointer Thierry Reding
2013-10-31 17:12 ` Stephen Boyd
2013-10-31 18:22 ` Mike Turquette
2013-11-01 9:13 ` Thierry Reding
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).