Fix various overflow conditions in KGSL