mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] perf/x86/intel/uncore: fix wrong box pointer check
@ 2017-06-29 19:09 kan.liang
  2017-06-29 19:35 ` [tip:x86/urgent] perf/x86/intel/uncore: Fix " tip-bot for Kan Liang
  0 siblings, 1 reply; 2+ messages in thread
From: kan.liang @ 2017-06-29 19:09 UTC (permalink / raw)
  To: tglx, mingo; +Cc: linux-kernel, Kan Liang

From: Kan Liang <kan.liang@intel.com>

Should not init a NULL box. It will cause system crash.
The issue looks like caused by a typo. It is introduced from:

commit fff4b87e594a ("perf/x86/intel/uncore: Make package handling
more robust")

This was not noticed because there is no NULL box. Also, for most
boxes, they are enabled by default. The init code is not critical.

Signed-off-by: Kan Liang <kan.liang@intel.com>
---
 arch/x86/events/intel/uncore.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c
index 758c1aa5009d..44ec523287f6 100644
--- a/arch/x86/events/intel/uncore.c
+++ b/arch/x86/events/intel/uncore.c
@@ -1170,7 +1170,7 @@ static int uncore_event_cpu_online(unsigned int cpu)
 		pmu = type->pmus;
 		for (i = 0; i < type->num_boxes; i++, pmu++) {
 			box = pmu->boxes[pkg];
-			if (!box && atomic_inc_return(&box->refcnt) == 1)
+			if (box && atomic_inc_return(&box->refcnt) == 1)
 				uncore_box_init(box);
 		}
 	}
-- 
2.11.0

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

end of thread, other threads:[~2017-06-29 19:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-29 19:09 [PATCH] perf/x86/intel/uncore: fix wrong box pointer check kan.liang
2017-06-29 19:35 ` [tip:x86/urgent] perf/x86/intel/uncore: Fix " tip-bot for Kan Liang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome