linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* arc_pmu not initialized in the arc/kernel/perf_event.c?
@ 2015-06-13 23:09 Max Filippov
  2015-06-15  5:50 ` Vineet Gupta
  0 siblings, 1 reply; 2+ messages in thread
From: Max Filippov @ 2015-06-13 23:09 UTC (permalink / raw)
  To: Mischa Jonker, Vineet Gupta; +Cc: linux-kernel, Max Filippov

Mischa, Vineet,

Looking at ARC PMU driver I've got an impression that its static arc_pmu
is left uninitialized, which possibly leads to Oops once registered
callbacks are invoked. I don't have neither ARC toolchain nor hardware to
test it, so I may be missing something. Below is the fix for it.

Thanks.
-- Max

---8<---
From: Max Filippov <jcmvbkbc@gmail.com>
Subject: [PATCH] arc: fix use of uninitialized arc_pmu

static arc_pmu in the arch/arc/kernel/perf_event.c is not initialized as
it's shadowed by a local variable of the same name in the
arc_pmu_device_probe.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
 arch/arc/kernel/perf_event.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arc/kernel/perf_event.c b/arch/arc/kernel/perf_event.c
index fd2ec50..57b58f5 100644
--- a/arch/arc/kernel/perf_event.c
+++ b/arch/arc/kernel/perf_event.c
@@ -266,7 +266,6 @@ static int arc_pmu_add(struct perf_event *event, int flags)
 
 static int arc_pmu_device_probe(struct platform_device *pdev)
 {
-	struct arc_pmu *arc_pmu;
 	struct arc_reg_pct_build pct_bcr;
 	struct arc_reg_cc_build cc_bcr;
 	int i, j, ret;
-- 
1.8.1.4

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

* Re: arc_pmu not initialized in the arc/kernel/perf_event.c?
  2015-06-13 23:09 arc_pmu not initialized in the arc/kernel/perf_event.c? Max Filippov
@ 2015-06-15  5:50 ` Vineet Gupta
  0 siblings, 0 replies; 2+ messages in thread
From: Vineet Gupta @ 2015-06-15  5:50 UTC (permalink / raw)
  To: Max Filippov, Alexey Brodkin; +Cc: linux-kernel

-CC Mischa (left Synopsys a while back)
+CC Alexey (does most fo perf work these days)

Hi Max,

On Sunday 14 June 2015 04:39 AM, Max Filippov wrote:
> Mischa, Vineet,
>
> Looking at ARC PMU driver I've got an impression that its static arc_pmu
> is left uninitialized, which possibly leads to Oops once registered
> callbacks are invoked. I don't have neither ARC toolchain nor hardware to
> test it, so I may be missing something. Below is the fix for it.
>
> Thanks.
> -- Max
>
> ---8<---
> From: Max Filippov <jcmvbkbc@gmail.com>
> Subject: [PATCH] arc: fix use of uninitialized arc_pmu
>
> static arc_pmu in the arch/arc/kernel/perf_event.c is not initialized as
> it's shadowed by a local variable of the same name in the
> arc_pmu_device_probe.
>
> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>

Thx for the fix. Indeed looks like a big SNAFU on my side. The reason we didn't
run into this despite pretty regular use of perf is that we have been using a
bunch of out of tree patches (recently floated for upstream) which removed the
offending code for other reasons. Neverthless I will add this  to for-next and CC
stable as well.

Thx,
-Vineet

> ---
>  arch/arc/kernel/perf_event.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/arch/arc/kernel/perf_event.c b/arch/arc/kernel/perf_event.c
> index fd2ec50..57b58f5 100644
> --- a/arch/arc/kernel/perf_event.c
> +++ b/arch/arc/kernel/perf_event.c
> @@ -266,7 +266,6 @@ static int arc_pmu_add(struct perf_event *event, int flags)
>  
>  static int arc_pmu_device_probe(struct platform_device *pdev)
>  {
> -	struct arc_pmu *arc_pmu;
>  	struct arc_reg_pct_build pct_bcr;
>  	struct arc_reg_cc_build cc_bcr;
>  	int i, j, ret;


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

end of thread, other threads:[~2015-06-15  5:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-13 23:09 arc_pmu not initialized in the arc/kernel/perf_event.c? Max Filippov
2015-06-15  5:50 ` Vineet Gupta

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