Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3017633rwb; Mon, 15 Aug 2022 16:14:17 -0700 (PDT) X-Google-Smtp-Source: AA6agR7gqlI1rEH48tWgcv8gk75isAPU+oJcVEwfWHcuMmC8Yw3RmsTP20LgMT80pufJcLbL1kaF X-Received: by 2002:a17:907:a0c6:b0:731:87ce:5289 with SMTP id hw6-20020a170907a0c600b0073187ce5289mr11936557ejc.465.1660605257574; Mon, 15 Aug 2022 16:14:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605257; cv=none; d=google.com; s=arc-20160816; b=J/eLuw+MmYCdN/5kBq3ePAC+z/ZM4VoT/VLqUvMP2Abw8uvp37KeQGfiaZj+t5ifpE dTTQwqFrDXia3tVobvBI5C1Heb8qh0aOYVWUccB0l7i/A8Zzk14xcA8JSD8StbhGu2Cv NTqfHuS1U2Rb3d9U9gqLeVrTrAY9G6VjAA7Tvflo003qrzwNRdTlTBZvOqJatt6gESeR YD7/G80SnP2aCgJLCt44WJIuEk0BXB+NT0BdaaTQl8f5OqIY2WtliOAyLSmGtC10aosi dmWHZmDhZuNRjM99rRSOs3IfrT+0qVWbGCqcywMJnrl6xrnY8FZyNWjBJ7uJmMclefY4 Hx0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0o+CV73aOpOqnBLjxAz1aSMpq+ZWAcyxKaEGFBSz308=; b=tK9o3qmzhs909qn9esJLOuNdLo+l+PyluAL/B5lx61d4gdOsM8+cpGxR7jFQ6fQai9 bEo73CL+dBYaIN8dt8QF7pFGJYPzizu9kRXKzKR7BIBmYABhdC8Awh7rKJQcQG5HoMad qBTxUsUO0IZ1fBmRVmJmAoTns75Ui0fIjdTWY6gxZJoiXaVjmCAGkeF39sNg6g1YINkD Q/IBdMFYZg2CJ/tA+NDDvu+K276HgWJpVRG9vb9y7PXOoiDZFAB9JSJgJ7tOROUtFHMz W0Bkfzvmo6Fx6NWJA+Qybn0ZXx8fr1tetekeTg++1CM/rZfgaEY21EGacCflYtYSRVYL Oe4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tI02wAyq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga33-20020a1709070c2100b00732f83eb741si9256713ejc.985.2022.08.15.16.13.51; Mon, 15 Aug 2022 16:14:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tI02wAyq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351268AbiHOWpR (ORCPT + 99 others); Mon, 15 Aug 2022 18:45:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350656AbiHOWkE (ORCPT ); Mon, 15 Aug 2022 18:40:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DE309FD1; Mon, 15 Aug 2022 12:51:52 -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 ams.source.kernel.org (Postfix) with ESMTPS id 4F559B80EAD; Mon, 15 Aug 2022 19:51:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97D00C433C1; Mon, 15 Aug 2022 19:51:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593110; bh=05K6e8DDsGvu0xMBaRum+fYSQ7upnYPuRy7qrtX142g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tI02wAyqbUsY3uURQdngfKEuEkscFZPMDjJgwWazPEtF8K2VGB+fh/7tfn7RgH8gI lFQCxIauZ6TXvX1ue1jVvZk2y0Hz7pMWhF0gOsHJJSfHB2bdJeWaZ0JER7kZ5TkwY+ thrFq7IihlqIBgV/os7q2xEPU+jatcbfhYZA08sU= 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.18 0897/1095] riscv: spinwait: Fix hartid variable type Date: Mon, 15 Aug 2022 20:04:56 +0200 Message-Id: <20220815180506.411004254@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 spinwait method") Signed-off-by: Sunil V L Reviewed-by: Atish Patra Link: https://lore.kernel.org/r/20220527051743.2829940-3-sunilvl@ventanamicro.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_ops_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(".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 @@ -29,7 +29,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.35.1