From patchwork Thu Jan 5 00:51:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13089345 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 E75D8C54EBD for ; Thu, 5 Jan 2023 00:56:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229880AbjAEAzg (ORCPT ); Wed, 4 Jan 2023 19:55:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230239AbjAEAyo (ORCPT ); Wed, 4 Jan 2023 19:54:44 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F76647335; Wed, 4 Jan 2023 16:51:30 -0800 (PST) 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 0A5CBB818F0; Thu, 5 Jan 2023 00:51:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 996F2C433F1; Thu, 5 Jan 2023 00:51:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672879887; bh=4aIDMnvVK/cTLHasisTKiXTMm58qBLZArVpwD6fnVeo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nGnOL3uQlRZc4QbM4HI+eNT1H2o82vAbdbiVxk7xy4nZLxwOjZzo5o4QNn6+qZDoH k4LbN1YcOBhEPdvBD2OvCM+1p18h2xO40Y9YN2RiXu27XdL+Q7h9FUWzR1wENH4h7P L6fULio4gg+0e0cFjdBckAcJRX8WYGrwv9Mda9UdPMThOczSkF47+BBKuImpeQgqQl WxDg3Fvs6chDNP6+qY31WRX/LeVYVTjNI5xuXVhn8agW8FgurUyiZS5xv+GkmkVZWx CAbvgzgYYJid38BvxFB06kOJ62k04e23UADvUnv2udVFiNK0MrRtErd0Kf4r6+nXDh sbJHBhAifMI5g== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 4EE055C05CA; Wed, 4 Jan 2023 16:51:27 -0800 (PST) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, Zhen Lei , Elliott@paulmck-ThinkPad-P17-Gen-1.home, Robert , Tejun Heo , "Peter Zijlstra (Intel)" , Josh Don , Andrew Morton , Frederic Weisbecker , "Paul E . McKenney" Subject: [PATCH rcu 1/6] genirq: Fix the return type of kstat_cpu_irqs_sum() Date: Wed, 4 Jan 2023 16:51:21 -0800 Message-Id: <20230105005126.1772294-1-paulmck@kernel.org> X-Mailer: git-send-email 2.31.1.189.g2e36527f23 In-Reply-To: <20230105005105.GA1772125@paulmck-ThinkPad-P17-Gen-1> References: <20230105005105.GA1772125@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: rcu@vger.kernel.org From: Zhen Lei The type of member ->irqs_sum is unsigned long, but kstat_cpu_irqs_sum() returns int, which can result in truncation. Therefore, change the kstat_cpu_irqs_sum() function's return value to unsigned long to avoid truncation. Fixes: f2c66cd8eedd ("/proc/stat: scalability of irq num per cpu") Reported-by: Elliott, Robert (Servers) Signed-off-by: Zhen Lei Cc: Tejun Heo Cc: "Peter Zijlstra (Intel)" Cc: Josh Don Cc: Andrew Morton Reviewed-by: Frederic Weisbecker Signed-off-by: Paul E. McKenney --- include/linux/kernel_stat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h index ddb5a358fd829..90e2fdc17d79f 100644 --- a/include/linux/kernel_stat.h +++ b/include/linux/kernel_stat.h @@ -75,7 +75,7 @@ extern unsigned int kstat_irqs_usr(unsigned int irq); /* * Number of interrupts per cpu, since bootup */ -static inline unsigned int kstat_cpu_irqs_sum(unsigned int cpu) +static inline unsigned long kstat_cpu_irqs_sum(unsigned int cpu) { return kstat_cpu(cpu).irqs_sum; }