Get rid of off_t integers and use uint64_t.

Also move uint64 multiplication overflow check to internal library.
This commit is contained in:
Milan Broz
2021-02-13 20:43:33 +01:00
parent f28e159ff2
commit 36fd8d6b3c
2 changed files with 28 additions and 29 deletions

View File

@@ -240,4 +240,12 @@ int crypt_compare_dm_devices(struct crypt_device *cd,
const struct crypt_dm_active_device *tgt);
static inline void *crypt_zalloc(size_t size) { return calloc(1, size); }
static inline bool uint64_mult_overflow(uint64_t *u, uint64_t b, size_t size)
{
*u = (uint64_t)b * size;
if ((uint64_t)(*u / size) != b)
return true;
return false;
}
#endif /* INTERNAL_H */