Fix issues detected by Coverity Scan

Most of Coverity Scan reports are false
positives, but in rare cases we have
confirmed (very small) issues.

No functional change.
Merge branch 'master' into closed_position
Reduce scale factors in a closed position

bench: 7905850