Skip to content

Commit 76d98ab

Browse files
santoshsmpe
authored andcommitted
powerpc/powernv: Get cpu only after validity check
Check for validity of cpu before calling get_hard_smp_processor_id(). Found with coverity. Signed-off-by: Santosh Sivaraj <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent 520eccd commit 76d98ab

File tree

1 file changed

+2
-1
lines changed
  • arch/powerpc/platforms/powernv

1 file changed

+2
-1
lines changed

arch/powerpc/platforms/powernv/smp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static void pnv_smp_setup_cpu(int cpu)
5757

5858
static int pnv_smp_kick_cpu(int nr)
5959
{
60-
unsigned int pcpu = get_hard_smp_processor_id(nr);
60+
unsigned int pcpu;
6161
unsigned long start_here =
6262
__pa(ppc_function_entry(generic_secondary_smp_init));
6363
long rc;
@@ -66,6 +66,7 @@ static int pnv_smp_kick_cpu(int nr)
6666
if (nr < 0 || nr >= nr_cpu_ids)
6767
return -EINVAL;
6868

69+
pcpu = get_hard_smp_processor_id(nr);
6970
/*
7071
* If we already started or OPAL is not supported, we just
7172
* kick the CPU via the PACA

0 commit comments

Comments
 (0)