linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/smp: Get cpu only after validity check
@ 2017-07-04  4:22 Santosh Sivaraj
  2017-07-27 12:37 ` Michael Ellerman
  0 siblings, 1 reply; 2+ messages in thread
From: Santosh Sivaraj @ 2017-07-04  4:22 UTC (permalink / raw)
  To: linuxppc-dev

Check for validity of cpu before calling get_hard_smp_processor_id.

Found with coverity.

Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
---
 arch/powerpc/platforms/powernv/smp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/powernv/smp.c b/arch/powerpc/platforms/powernv/smp.c
index 40dae96..c6448c7 100644
--- a/arch/powerpc/platforms/powernv/smp.c
+++ b/arch/powerpc/platforms/powernv/smp.c
@@ -57,7 +57,7 @@ static void pnv_smp_setup_cpu(int cpu)
 
 static int pnv_smp_kick_cpu(int nr)
 {
-	unsigned int pcpu = get_hard_smp_processor_id(nr);
+	unsigned int pcpu;
 	unsigned long start_here =
 			__pa(ppc_function_entry(generic_secondary_smp_init));
 	long rc;
@@ -66,6 +66,7 @@ static int pnv_smp_kick_cpu(int nr)
 	if (nr < 0 || nr >= nr_cpu_ids)
 		return -EINVAL;
 
+	pcpu = get_hard_smp_processor_id(nr);
 	/*
 	 * If we already started or OPAL is not supported, we just
 	 * kick the CPU via the PACA
-- 
2.9.4

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

* Re: powerpc/smp: Get cpu only after validity check
  2017-07-04  4:22 [PATCH] powerpc/smp: Get cpu only after validity check Santosh Sivaraj
@ 2017-07-27 12:37 ` Michael Ellerman
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2017-07-27 12:37 UTC (permalink / raw)
  To: Santosh Sivaraj, linuxppc-dev

On Tue, 2017-07-04 at 04:22:46 UTC, Santosh Sivaraj wrote:
> Check for validity of cpu before calling get_hard_smp_processor_id.
> 
> Found with coverity.
> 
> Signed-off-by: Santosh Sivaraj <santosh@fossix.org>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/76d98ab4628bf8d36498e8228a5b92

cheers

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

end of thread, other threads:[~2017-07-27 12:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-04  4:22 [PATCH] powerpc/smp: Get cpu only after validity check Santosh Sivaraj
2017-07-27 12:37 ` Michael Ellerman

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