提交 09f78ae4 编写于 作者: Z Zhen Lei 提交者: Yongqiang Liu

genirq: Fix the return type of kstat_cpu_irqs_sum()

stable inclusion
from stable-v4.19.276
commit b84d49628b0fcb1c4925b565ccfeb50a0b0f4630
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I6TIG1
CVE: NA

--------------------------------

[ Upstream commit 47904aed ]

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: f2c66cd8 ("/proc/stat: scalability of irq num per cpu")
Reported-by: NElliott, Robert (Servers) <elliott@hpe.com>
Signed-off-by: NZhen Lei <thunder.leizhen@huawei.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
Cc: Josh Don <joshdon@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: NFrederic Weisbecker <frederic@kernel.org>
Signed-off-by: NPaul E. McKenney <paulmck@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
上级 e0ccb64b
...@@ -75,7 +75,7 @@ extern unsigned int kstat_irqs_usr(unsigned int irq); ...@@ -75,7 +75,7 @@ extern unsigned int kstat_irqs_usr(unsigned int irq);
/* /*
* Number of interrupts per cpu, since bootup * 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; return kstat_cpu(cpu).irqs_sum;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册