Skip to content

Commit

Permalink
parisc: Use num_present_cpus() in alternative patching code
Browse files Browse the repository at this point in the history
When patching the kernel code some alternatives depend on SMP vs. !SMP.
Use the value of num_present_cpus() instead of num_online_cpus() to
decide, otherwise we may run into issues if and additional CPU is
enabled after having loaded a module while only one CPU was enabled.

Signed-off-by: Helge Deller <deller@gmx.de>
Cc: <stable@vger.kernel.org> # v6.1+
  • Loading branch information
Helge Deller committed May 23, 2023
1 parent d703797 commit b6405f0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/parisc/kernel/alternative.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void __init_or_module apply_alternatives(struct alt_instr *start,
{
struct alt_instr *entry;
int index = 0, applied = 0;
int num_cpus = num_online_cpus();
int num_cpus = num_present_cpus();
u16 cond_check;

cond_check = ALT_COND_ALWAYS |
Expand Down

0 comments on commit b6405f0

Please sign in to comment.