linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] clk: fix a panic error caused by accessing NULL pointer
@ 2017-11-21  9:24 Chunyan Zhang
  2017-12-05 23:28 ` Stephen Boyd
  0 siblings, 1 reply; 3+ messages in thread
From: Chunyan Zhang @ 2017-11-21  9:24 UTC (permalink / raw)
  To: Stephen Boyd, Michael Turquette
  Cc: linux-clk, linux-kernel, Cai Li, Orson Zhai, Chunyan Zhang

From: Cai Li <cai.li@spreadtrum.com>

In some cases the clock parent would be set NULL when doing re-parent,
it will cause a NULL pointer accessing if clk_set trace event is
enabled.

This patch sets the parent as "none" if the input parameter is NULL.

Fixes: dfc202ead312 (clk: Add tracepoints for hardware operations)
Signed-off-by: Cai Li <cai.li@spreadtrum.com>
Signed-off-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>
---
Changes from v1:
Revised the tracepoint code instead of clk driver.
---
 include/trace/events/clk.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/trace/events/clk.h b/include/trace/events/clk.h
index 7586072..2cd4493 100644
--- a/include/trace/events/clk.h
+++ b/include/trace/events/clk.h
@@ -134,12 +134,12 @@ DECLARE_EVENT_CLASS(clk_parent,
 
 	TP_STRUCT__entry(
 		__string(        name,           core->name                )
-		__string(        pname,          parent->name              )
+		__string(        pname, parent ? parent->name : "none"     )
 	),
 
 	TP_fast_assign(
 		__assign_str(name, core->name);
-		__assign_str(pname, parent->name);
+		__assign_str(pname, parent ? parent->name : "none");
 	),
 
 	TP_printk("%s %s", __get_str(name), __get_str(pname))
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH V2] clk: fix a panic error caused by accessing NULL pointer
  2017-11-21  9:24 [PATCH V2] clk: fix a panic error caused by accessing NULL pointer Chunyan Zhang
@ 2017-12-05 23:28 ` Stephen Boyd
  2017-12-06  7:51   ` Chunyan Zhang
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Boyd @ 2017-12-05 23:28 UTC (permalink / raw)
  To: Chunyan Zhang
  Cc: Michael Turquette, linux-clk, linux-kernel, Cai Li, Orson Zhai,
	Chunyan Zhang

On 11/21, Chunyan Zhang wrote:
> From: Cai Li <cai.li@spreadtrum.com>
> 
> In some cases the clock parent would be set NULL when doing re-parent,
> it will cause a NULL pointer accessing if clk_set trace event is
> enabled.
> 
> This patch sets the parent as "none" if the input parameter is NULL.
> 
> Fixes: dfc202ead312 (clk: Add tracepoints for hardware operations)
> Signed-off-by: Cai Li <cai.li@spreadtrum.com>
> Signed-off-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>
> ---

Applied to clk-fixes

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH V2] clk: fix a panic error caused by accessing NULL pointer
  2017-12-05 23:28 ` Stephen Boyd
@ 2017-12-06  7:51   ` Chunyan Zhang
  0 siblings, 0 replies; 3+ messages in thread
From: Chunyan Zhang @ 2017-12-06  7:51 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Chunyan Zhang, Michael Turquette, linux-clk,
	linux-kernel@vger.kernel.org, Cai Li, Orson Zhai

On 6 December 2017 at 07:28, Stephen Boyd <sboyd@codeaurora.org> wrote:
> On 11/21, Chunyan Zhang wrote:
>> From: Cai Li <cai.li@spreadtrum.com>
>>
>> In some cases the clock parent would be set NULL when doing re-parent,
>> it will cause a NULL pointer accessing if clk_set trace event is
>> enabled.
>>
>> This patch sets the parent as "none" if the input parameter is NULL.
>>
>> Fixes: dfc202ead312 (clk: Add tracepoints for hardware operations)
>> Signed-off-by: Cai Li <cai.li@spreadtrum.com>
>> Signed-off-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>
>> ---
>
> Applied to clk-fixes

Thanks!

Chunyan

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-12-06  7:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-21  9:24 [PATCH V2] clk: fix a panic error caused by accessing NULL pointer Chunyan Zhang
2017-12-05 23:28 ` Stephen Boyd
2017-12-06  7:51   ` Chunyan Zhang

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).