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
This commit is contained in:
Andrey Ryabinin 2021-11-15 19:46:05 +03:00 committed by Peter Zijlstra
parent 9731698ecb
commit c7ccbf4b61
1 changed files with 2 additions and 1 deletions

View File

@ -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
/*