Fix benign unsigned integer overflows in loop conditions

This is causing an abort when running with unsigned integer overflow
detection, change the code to no longer do i-- when i = 0.

Change-Id: I0ab786cabb3a3d37fa24a3b8da0c35dd475ca273
(cerry picked from commit b92add32c22656dedfb82d26ccc168c43c92b8eb)
2 files changed