Skip to content

CPU Plugin: Prevent integer overflow of total usage

Arjen Hiemstra requested to merge work/ahiemstra/cpuusage into master

In some cases, the values we read from the system can result in a negative difference to the previous values. This was already guarded partially, but only for system/user/wait usage. Total usage would still be able to go negative, resulting in overflow of the total usage.

Instead, ensure that all the differences are always at least 0, so if we add things together we aren't adding negatives.

BUG: 448626

Merge request reports