coverity#1078669 Failure to restore non-local value

Change-Id: I3817295a39e409cf5a9ab72b9b24d7b859f5a186
coverity#705106 Integer overflowed argument

Change-Id: I843b02cb8d215c149aa646441f3c7b0ab5550906