Re: [PATCH] clk: fix possible null pointer dereference

2015-01-17 Thread Mike Turquette
Quoting Stephen Boyd (2015-01-05 11:34:32)
> On 01/05/2015 08:04 AM, Stanimir Varbanov wrote:
> > The commit 646cafc6 (clk: Change clk_ops->determine_rate to
> > return a clk_hw as the best parent) opens a possibility for
> > null pointer dereference, fix this.
> >
> > Signed-off-by: Stanimir Varbanov 
> 
> Yep. Hopefully we can clean this all up soon.
> 
> Reviewed-by: Stephen Boyd 

Applied to clk-fixes.

Regards,
Mike

> 
> > ---
> >  drivers/clk/clk.c |2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> > index f4963b7..d48ac71 100644
> > --- a/drivers/clk/clk.c
> > +++ b/drivers/clk/clk.c
> > @@ -1366,7 +1366,7 @@ static struct clk *clk_calc_new_rates(struct clk 
> > *clk, unsigned long rate)
> >   new_rate = clk->ops->determine_rate(clk->hw, rate,
> >   &best_parent_rate,
> >   &parent_hw);
> > - parent = parent_hw->clk;
> > + parent = parent_hw ? parent_hw->clk : NULL;
> >   } else if (clk->ops->round_rate) {
> >   new_rate = clk->ops->round_rate(clk->hw, rate,
> >   &best_parent_rate);
> 
> 
> -- 
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> a Linux Foundation Collaborative Project
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] clk: fix possible null pointer dereference

2015-01-05 Thread Stephen Boyd
On 01/05/2015 08:04 AM, Stanimir Varbanov wrote:
> The commit 646cafc6 (clk: Change clk_ops->determine_rate to
> return a clk_hw as the best parent) opens a possibility for
> null pointer dereference, fix this.
>
> Signed-off-by: Stanimir Varbanov 

Yep. Hopefully we can clean this all up soon.

Reviewed-by: Stephen Boyd 

> ---
>  drivers/clk/clk.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index f4963b7..d48ac71 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -1366,7 +1366,7 @@ static struct clk *clk_calc_new_rates(struct clk *clk, 
> unsigned long rate)
>   new_rate = clk->ops->determine_rate(clk->hw, rate,
>   &best_parent_rate,
>   &parent_hw);
> - parent = parent_hw->clk;
> + parent = parent_hw ? parent_hw->clk : NULL;
>   } else if (clk->ops->round_rate) {
>   new_rate = clk->ops->round_rate(clk->hw, rate,
>   &best_parent_rate);


-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] clk: fix possible null pointer dereference

2015-01-05 Thread Stanimir Varbanov
The commit 646cafc6 (clk: Change clk_ops->determine_rate to
return a clk_hw as the best parent) opens a possibility for
null pointer dereference, fix this.

Signed-off-by: Stanimir Varbanov 
---
 drivers/clk/clk.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index f4963b7..d48ac71 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1366,7 +1366,7 @@ static struct clk *clk_calc_new_rates(struct clk *clk, 
unsigned long rate)
new_rate = clk->ops->determine_rate(clk->hw, rate,
&best_parent_rate,
&parent_hw);
-   parent = parent_hw->clk;
+   parent = parent_hw ? parent_hw->clk : NULL;
} else if (clk->ops->round_rate) {
new_rate = clk->ops->round_rate(clk->hw, rate,
&best_parent_rate);
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/