[PATCH 4.9 11/26] profiling: fix shift-out-of-bounds bugs