intel_cstates: Fix integer division inaccuracy
Integer division could have result in an out of bound substate.
This commit is contained in:
parent
d01fa1ffe3
commit
ae81c98aaf
@ -83,7 +83,8 @@ cstates_idle(void)
|
|||||||
ASSERT(state >= 0 && state < sCStateCount);
|
ASSERT(state >= 0 && state < sCStateCount);
|
||||||
|
|
||||||
int subState = idleTime % timeStep;
|
int subState = idleTime % timeStep;
|
||||||
subState /= timeStep / sCStates[state].fSubStatesCount;
|
subState *= sCStates[state].fSubStatesCount;
|
||||||
|
subState /= timeStep;
|
||||||
|
|
||||||
ASSERT(subState >= 0 && subState < sCStates[state].fSubStatesCount);
|
ASSERT(subState >= 0 && subState < sCStates[state].fSubStatesCount);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user