Replace fatal BUG_ON() with more safe WARN_ON_ONCE() in cpuacct_cpuusage_read().
Showing the changes to kernel (1 of 1 file). Show all
Unified · Split
| @@ -106,7 +106,8 @@ static u64 cpuacct_cpuusage_read(struct cpuacct *ca, int cpu, · 105 unmodified lines | ||
| 106 | 106 | * We allow index == CPUACCT_STAT_NSTATS here to read |
| 107 | 107 | * the sum of usages. |
| 108 | 108 | */ |
| 109 | − BUG_ON(index > CPUACCT_STAT_NSTATS); | |
| 109 | + if (WARN_ON_ONCE(index > CPUACCT_STAT_NSTATS)) | |
| 110 | + return 0; | |
| 110 | 111 | |
| 111 | 112 | #ifndef CONFIG_64BIT |
| 112 | 113 | /* |