acct: fix potential integer overflow in encode_comp_t()
[linux-2.6-microblaze.git] / kernel / acct.c
index 31b09cf..010667c 100644 (file)
@@ -350,6 +350,8 @@ static comp_t encode_comp_t(u64 value)
                exp++;
        }
 
+       if (exp > (((comp_t) ~0U) >> MANTSIZE))
+               return (comp_t) ~0U;
        /*
         * Clean it up and polish it off.
         */