mirror of
https://github.com/GrapheneOS/hardened_malloc.git
synced 2024-10-01 01:36:01 -04:00
avoid unnecessary preprocessor use for canary mask
This commit is contained in:
parent
93fcc6a978
commit
5811bd184c
8
malloc.c
8
malloc.c
@ -274,11 +274,9 @@ static void write_after_free_check(char *p, size_t size) {
|
||||
}
|
||||
}
|
||||
|
||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
static const uint64_t canary_mask = 0xffffffffffffff00UL;
|
||||
#else
|
||||
static const uint64_t canary_mask = 0x00ffffffffffffffUL;
|
||||
#endif
|
||||
static const uint64_t canary_mask = __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ ?
|
||||
0xffffffffffffff00UL :
|
||||
0x00ffffffffffffffUL;
|
||||
|
||||
static void set_canary(struct slab_metadata *metadata, void *p, size_t size) {
|
||||
memcpy((char *)p + size - canary_size, &metadata->canary_value, canary_size);
|
||||
|
Loading…
Reference in New Issue
Block a user