diff options
author | Andrey Ryabinin <arbn@yandex-team.com> | 2021-11-15 19:46:05 +0300 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2021-11-23 09:55:22 +0100 |
commit | c7ccbf4b6174e32c130892570db06d0f496cfef0 (patch) | |
tree | 92fb3ed324c0b01c187392c70c98ed4e0f36a66e /kernel/sched/cpuacct.c | |
parent | 9731698ecb9c851f353ce2496292ff9fcea39dff (diff) | |
download | linux-c7ccbf4b6174e32c130892570db06d0f496cfef0.tar.gz linux-c7ccbf4b6174e32c130892570db06d0f496cfef0.tar.bz2 linux-c7ccbf4b6174e32c130892570db06d0f496cfef0.zip |
cpuacct: Convert BUG_ON() to WARN_ON_ONCE()
Replace fatal BUG_ON() with more safe WARN_ON_ONCE() in cpuacct_cpuusage_read().
Signed-off-by: Andrey Ryabinin <arbn@yandex-team.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://lore.kernel.org/r/20211115164607.23784-2-arbn@yandex-team.com
Diffstat (limited to 'kernel/sched/cpuacct.c')
-rw-r--r-- | kernel/sched/cpuacct.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c index 893eece65bfd..f347cf9e4634 100644 --- a/kernel/sched/cpuacct.c +++ b/kernel/sched/cpuacct.c @@ -106,7 +106,8 @@ static u64 cpuacct_cpuusage_read(struct cpuacct *ca, int cpu, * We allow index == CPUACCT_STAT_NSTATS here to read * the sum of usages. */ - BUG_ON(index > CPUACCT_STAT_NSTATS); + if (WARN_ON_ONCE(index > CPUACCT_STAT_NSTATS)) + return 0; #ifndef CONFIG_64BIT /* |