From nobody Mon Sep 29 22:46:25 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDF3AC2BB47 for ; Tue, 16 Aug 2022 04:52:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233331AbiHPEu4 (ORCPT ); Tue, 16 Aug 2022 00:50:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232289AbiHPEq6 (ORCPT ); Tue, 16 Aug 2022 00:46:58 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 738A2A2208; Mon, 15 Aug 2022 13:43:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id C3A74CE12E9; Mon, 15 Aug 2022 20:43:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EBCDC433D6; Mon, 15 Aug 2022 20:43:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660596192; bh=05K6e8DDsGvu0xMBaRum+fYSQ7upnYPuRy7qrtX142g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g2TRFBWoZLO2g8vy0UCxYJ1T3YCAfiZzwkdMN7BRvzlm20rgETjS2WiuY6G8SAiPD rN89gfgtfzqXOCXowzy+k1autXLxzYbauQLawTxZoMDMMBoWHVgq7pjz2fCrwb5v0X 1tKR+ED5MZrwA2jrqhhJNXhl7PX35liXSl+wZm1c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sunil V L , Atish Patra , Palmer Dabbelt , Sasha Levin Subject: [PATCH 5.19 0974/1157] riscv: spinwait: Fix hartid variable type Date: Mon, 15 Aug 2022 20:05:30 +0200 Message-Id: <20220815180518.681002556@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sunil V L [ Upstream commit c029e487e7c00e5594a4ae946952605db34e359b ] 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 spin= wait method") Signed-off-by: Sunil V L Reviewed-by: Atish Patra Link: https://lore.kernel.org/r/20220527051743.2829940-3-sunilvl@ventanamic= ro.com Signed-off-by: Palmer Dabbelt Signed-off-by: Sasha Levin --- 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_o= ps_spinwait.c index c662a7cf10a4..d98d19226b5f 100644 --- a/arch/riscv/kernel/cpu_ops_spinwait.c +++ b/arch/riscv/kernel/cpu_ops_spinwait.c @@ -20,7 +20,7 @@ void *__cpu_spinwait_task_pointer[NR_CPUS] __section(".da= ta"); static void cpu_update_secondary_bootdata(unsigned int cpuid, struct task_struct *tidle) { - int hartid =3D cpuid_to_hartid_map(cpuid); + unsigned long hartid =3D cpuid_to_hartid_map(cpuid); =20 /* * The hartid must be less than NR_CPUS to avoid out-of-bound access @@ -29,7 +29,7 @@ static void cpu_update_secondary_bootdata(unsigned int cp= uid, * spinwait booting is not the recommended approach for any platforms * booting Linux in S-mode and can be disabled in the future. */ - if (hartid =3D=3D INVALID_HARTID || hartid >=3D NR_CPUS) + if (hartid =3D=3D INVALID_HARTID || hartid >=3D (unsigned long) NR_CPUS) return; =20 /* Make sure tidle is updated */ --=20 2.35.1