Skip to content

Commit 3f1b041

Browse files
authored
Merge pull request #142 from struct/fixes_9_2022
Minor last minute cleanups before new version
2 parents 1c3e857 + 52c7c57 commit 3f1b041

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

include/iso_alloc_internal.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,11 @@ assert(sizeof(size_t) >= 64)
240240
#define BIG_ZONE_USER_PAGE_COUNT 2
241241
#define BIG_ZONE_USER_PAGE_COUNT_SHIFT 1
242242

243+
#if MEMORY_TAGGING
243244
#define TAGGED_PTR_MASK 0x00ffffffffffffff
244245
#define IS_TAGGED_PTR_MASK 0xff00000000000000
245246
#define UNTAGGED_BITS 56
246-
247-
/* A uint64_t of bitslots below this value will
248-
* have at least 1 single free bit slot */
249-
#define ALLOCATED_BITSLOTS 0x5555555555555555
247+
#endif
250248

251249
#define MEGABYTE_SIZE 1048576
252250
#define KILOBYTE_SIZE 1024

src/iso_alloc.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,6 +1007,14 @@ INTERNAL_HIDDEN ASSUME_ALIGNED void *_iso_calloc(size_t nmemb, size_t size) {
10071007

10081008
void *p = _iso_alloc(NULL, sz);
10091009

1010+
#if NO_ZERO_ALLOCATIONS
1011+
/* Without this check we would immediately segfault in
1012+
* the call to __iso_memset() to zeroize the chunk */
1013+
if(UNLIKELY(sz == 0)) {
1014+
return p;
1015+
}
1016+
#endif
1017+
10101018
__iso_memset(p, 0x0, sz);
10111019
return p;
10121020
}

0 commit comments

Comments
 (0)