[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOnJCUK5i0HpU-=h41Z9PcOHWwndB7iX6ePb2kyuEf1qaSKytA@mail.gmail.com>
Date: Thu, 26 May 2022 15:56:34 -0700
From: Atish Patra <atishp@...shpatra.org>
To: Sunil V L <sunilvl@...tanamicro.com>
Cc: Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ard Biesheuvel <ardb@...nel.org>,
Marc Zyngier <maz@...nel.org>,
Atish Patra <atishp@...osinc.com>,
Heinrich Schuchardt <heinrich.schuchardt@...onical.com>,
Anup Patel <apatel@...tanamicro.com>,
linux-riscv <linux-riscv@...ts.infradead.org>,
"linux-kernel@...r.kernel.org List" <linux-kernel@...r.kernel.org>,
linux-efi <linux-efi@...r.kernel.org>,
Sunil V L <sunil.vl@...il.com>, stable@...r.kernel.org
Subject: Re: [PATCH V2 2/5] riscv: spinwait: Fix hartid variable type
On Thu, May 26, 2022 at 3:12 AM Sunil V L <sunilvl@...tanamicro.com> wrote:
>
> 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: c78f94f35cf6 ("RISC-V: Use __cpu_up_stack/task_pointer only for spinwait method")
> Cc: stable@...r.kernel.org
>
> Signed-off-by: Sunil V L <sunilvl@...tanamicro.com>
> ---
> arch/riscv/kernel/cpu_ops_spinwait.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/riscv/kernel/cpu_ops_spinwait.c b/arch/riscv/kernel/cpu_ops_spinwait.c
> index 346847f6c41c..3ade9152a3c7 100644
> --- a/arch/riscv/kernel/cpu_ops_spinwait.c
> +++ b/arch/riscv/kernel/cpu_ops_spinwait.c
> @@ -18,7 +18,7 @@ void *__cpu_spinwait_task_pointer[NR_CPUS] __section(".data");
> static void cpu_update_secondary_bootdata(unsigned int cpuid,
> struct task_struct *tidle)
> {
> - int hartid = cpuid_to_hartid_map(cpuid);
> + unsigned long hartid = cpuid_to_hartid_map(cpuid);
>
> /*
> * 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,
> * spinwait booting is not the recommended approach for any platforms
> * booting Linux in S-mode and can be disabled in the future.
> */
> - if (hartid == INVALID_HARTID || hartid >= NR_CPUS)
> + if (hartid == INVALID_HARTID || hartid >= (unsigned long) NR_CPUS)
> return;
>
> /* Make sure tidle is updated */
> --
> 2.25.1
>
Reviewed-by: Atish Patra <atishp@...osinc.com>
--
Regards,
Atish
Powered by blists - more mailing lists