x86/apic/x2apic, smp/hotplug: Don't use before alloc in x2apic_cluster_probe()
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Thu, 11 Aug 2016 14:08:35 +0000 (16:08 +0200)
committerIngo Molnar <mingo@kernel.org>
Thu, 11 Aug 2016 14:35:50 +0000 (16:35 +0200)
commitd52c0569bab4edc888832df44dc7ac28517134f6
tree08f85c178412248d9b491375c57ad9813f4e3e90
parent5bc653b7318217c54244a14f248f1f07abe0a865
x86/apic/x2apic, smp/hotplug: Don't use before alloc in x2apic_cluster_probe()

I made a mistake while converting the driver to the hotplug state
machine and as a result x2apic_cluster_probe() was accessing
cpus_in_cluster before allocating it.

This patch fixes it by setting the cpumask after the allocation the
memory succeeded.

While at it, I marked two functions static which are only used within
this file.

Reported-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: 6b2c28471de5 ("x86/x2apic: Convert to CPU hotplug state machine")
Link: http://lkml.kernel.org/r/1470924515-9444-1-git-send-email-bigeasy@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/kernel/apic/x2apic_cluster.c