Deb package build fix for CUDA 6.5 and newer.

(cherry picked from commit e650d87e470b2e6a8f87ad4dd81977748a136aee)
More accurate deb package build fix for CUDA 6.5 and newer.

(cherry picked from commit b2790973a32eb662c165a921afe03dbfd2c65269)
GCC 4.8 warning array subscript is above array bounds fixed.

(cherry picked from commit e11333dd831ef43f962e513e26f3dfa6dc789155)