Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2366001ioo; Sat, 28 May 2022 11:25:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCy/987zoBUBA53kuGtmlNNxIrEWP12CCTcHCn/yUsM763jQYvoIoq9gytN4DQnXGRB9iH X-Received: by 2002:a17:90b:4c4a:b0:1df:9cbf:879f with SMTP id np10-20020a17090b4c4a00b001df9cbf879fmr14260971pjb.84.1653762335738; Sat, 28 May 2022 11:25:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653762335; cv=none; d=google.com; s=arc-20160816; b=XF/Ps8udBFJoyJWRziZaqNX6UPPniZboNM7Q/i0PCbmtR6c/G0uJa6FeBk+XO4fnQ8 MPLpiO9csyfPFh9Ou7E65ulY8A+HkxShUy2vOFf1QTivCr3qxyILDdbt5v6RV67UeCJo i4trtBonwBN5h41nSiWw1BXEd6o5e6siqu5hPtlUV8gDjMVYKyla1EEyRwiYF7+JZkFt q2Mz3L0ksGY+kgK+vHKGcK7LeZMu3Y6gx3DmPEOn7d9mf7p0uB473sD8pDbKeM6Mfd// PwsJ4cszBja9vcFKgomZ4GBcMT25b2JRrNt9qipm7/zUtp7PV/4Akqhb7joegx+66N9u bDmg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=a527G06H+rTZVQ9Z54L95xKvwRXeKSz+Vdkmm5vxnGU=; b=Co2a6qtjaDAL6H616k6AUG55yoU3UGz9XgOQwOIwfm0uT3TlYSdqCfAJV9y7BZBM19 PHme7jSC3hlKZcs56GlGeEGeVTZSAkbq3bfnCujB99DGtu85eF454R3O+c/xZbRNxH13 jUih84QO28Maz2H4RDvG38i5NHJoU/f60OSTPGK29DpLlZjgDv2Xi7GwFi/uKRq6Hiig cTDiZlNJHNRguROn8Nx4thQ8pyCaWhpBCBCLYIrBUy9CkinEFbur8yYKhdNEmjA0V+jN sMyOS62nunBH4sQ36kf5uMfhNQ5/QTroEiU2WgngF4zrBgIrBuPHBXSHrqxjXEpuZCHm T9Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=TzZc0MO6; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id s16-20020a056a00195000b005106eb25aebsi10009667pfk.211.2022.05.28.11.25.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 11:25:35 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=TzZc0MO6; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6522B1759E; Sat, 28 May 2022 11:25:27 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243426AbiE0FSJ (ORCPT + 99 others); Fri, 27 May 2022 01:18:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243101AbiE0FSB (ORCPT ); Fri, 27 May 2022 01:18:01 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C318F3138D for ; Thu, 26 May 2022 22:17:59 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id f18so3267775plg.0 for ; Thu, 26 May 2022 22:17:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=a527G06H+rTZVQ9Z54L95xKvwRXeKSz+Vdkmm5vxnGU=; b=TzZc0MO6AfCtlteb9bCnmlhRJEVJvMRF3GI1QjfK6DuAUuzHwL6zhWECRnZ2JZl1JY Z77nIxa0np9ZOkDHvyfgQcFFUI8ptER4ES5juS2cPeaqTUslq9lNPZC+U7FuXLRK6TWd Qzy9wZ479GcfvWsXR1xDEHZK6oA7zDhwdg1oONTDxoMqhfpHKcUIQmqt+549nrdZWid7 ln0vEhIAy3enxkwU+BHpwnK85yTozOM3ylbmNXqK0dC0fv4bMhROtEtVaeyM1tW4lBXP PK8nbF9aa4gb1QSDcJQE5slBaG9QgWoDlQ+mHUizYCzh/JBX14DiPHQMLGLnFIvMhK9B 342Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=a527G06H+rTZVQ9Z54L95xKvwRXeKSz+Vdkmm5vxnGU=; b=IvT8tcDhn6BjLWgTmwO6ZJuV6FF8Dqukel7w+7bpkXz9728r2wRXgzdNAwsaEPC6s9 zqm46TJdswXAjWNgEKhnBA4o+I6ZwforXlF7zh+m2mTHHEBzN6y0o9cTJUiIZTYzYQng Ep9r8ZEpU4XtEULs9IQ39V4yd3sppkvl+53+REW49DVxFkuEcUyYwmckSPkRMX4m9xrl huFgQXCA810cRGJy0KFXr+M4W2IcJEcTEuKKJY4zsx05XQgEJwhDM39aS+vFbkNRRMY/ 5xWfJsyhfKethfs7funA2JJl+KUtMh0UkEaKPipWfyzLOtff5rqEOnSAh0KyvFcXriKD oexg== X-Gm-Message-State: AOAM530S+dFs1UoEiT/RZoOO+Eyl//rnBXOeTNS9V641wmg9NiFiBHgi TBbiu6JTs2NNuNjh6189P3qsCQ== X-Received: by 2002:a17:902:cecc:b0:162:4d5c:3eac with SMTP id d12-20020a170902cecc00b001624d5c3eacmr15415645plg.82.1653628679351; Thu, 26 May 2022 22:17:59 -0700 (PDT) Received: from kerodipc.Dlink ([49.206.9.238]) by smtp.gmail.com with ESMTPSA id j34-20020a634a62000000b003c14af5063fsm2459003pgl.87.2022.05.26.22.17.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 May 2022 22:17:58 -0700 (PDT) From: Sunil V L To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Daniel Lezcano , Thomas Gleixner , Ard Biesheuvel , Marc Zyngier , Atish Patra , Heinrich Schuchardt , Anup Patel Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, Sunil V L , Sunil V L , stable@vger.kernel.org Subject: [PATCH V3 2/5] riscv: spinwait: Fix hartid variable type Date: Fri, 27 May 2022 10:47:40 +0530 Message-Id: <20220527051743.2829940-3-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220527051743.2829940-1-sunilvl@ventanamicro.com> References: <20220527051743.2829940-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 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@vger.kernel.org Signed-off-by: Sunil V L Reviewed-by: Atish Patra --- 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