Skip to content

Commit c029e48

Browse files
vlsunilpalmer-dabbelt
authored andcommitted
riscv: spinwait: Fix hartid variable type
The hartid variable is of type int but compared with ULONG_MAX(INVALID_HARTID). This issue is fixed by changing the hartid variable type to unsigned long. Fixes: c78f94f ("RISC-V: Use __cpu_up_stack/task_pointer only for spinwait method") Signed-off-by: Sunil V L <sunilvl@ventanamicro.com> Reviewed-by: Atish Patra <atishp@rivosinc.com> Link: https://lore.kernel.org/r/20220527051743.2829940-3-sunilvl@ventanamicro.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent 869d40b commit c029e48

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

arch/riscv/kernel/cpu_ops_spinwait.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ void *__cpu_spinwait_task_pointer[NR_CPUS] __section(".data");
1818
static void cpu_update_secondary_bootdata(unsigned int cpuid,
1919
struct task_struct *tidle)
2020
{
21-
int hartid = cpuid_to_hartid_map(cpuid);
21+
unsigned long hartid = cpuid_to_hartid_map(cpuid);
2222

2323
/*
2424
* The hartid must be less than NR_CPUS to avoid out-of-bound access
@@ -27,7 +27,7 @@ static void cpu_update_secondary_bootdata(unsigned int cpuid,
2727
* spinwait booting is not the recommended approach for any platforms
2828
* booting Linux in S-mode and can be disabled in the future.
2929
*/
30-
if (hartid == INVALID_HARTID || hartid >= NR_CPUS)
30+
if (hartid == INVALID_HARTID || hartid >= (unsigned long) NR_CPUS)
3131
return;
3232

3333
/* Make sure tidle is updated */

0 commit comments

Comments
 (0)