History

cpuacct: Convert BUG_ON() to WARN_ON_ONCE()

Replace fatal BUG_ON() with more safe WARN_ON_ONCE() in cpuacct_cpuusage_read().

Andrey Ryabinin committed 5 years ago

Commit c7ccbf41 parent 97316981 file · +2 −1Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/sched/cpuacct.c+2−1
@@ -106,7 +106,8 @@ static u64 cpuacct_cpuusage_read(struct cpuacct *ca, int cpu, · 105 unmodified lines
106106 * We allow index == CPUACCT_STAT_NSTATS here to read
107107 * the sum of usages.
108108 */
109− BUG_ON(index > CPUACCT_STAT_NSTATS);
109+ if (WARN_ON_ONCE(index > CPUACCT_STAT_NSTATS))
110+ return 0;
110111
111112 #ifndef CONFIG_64BIT
112113 /*