diff options
author | Alex Richardson <alexrichardson@google.com> | 2021-12-09 14:37:45 +0000 |
---|---|---|
committer | Travis Geiselbrecht <travisg@gmail.com> | 2023-04-23 17:23:31 -0700 |
commit | 7b12b201fde1b2abd526aeea138fb932b79c631b (patch) | |
tree | 5b786f97882fe95541e0c602a48b654389ecbb6e | |
parent | a1eb850079f4059ee0c22a7da07c473a423ec1c1 (diff) | |
download | lk-7b12b201fde1b2abd526aeea138fb932b79c631b.tar.gz |
[dlmalloc] Fix -Wnull-pointer-arithmetic
Arithmetic on a NULL pointer is undefined behaviour and could be used by
the compiler to optimize out the arithmetic. Use the integer expansion of
chunk2mem(0) instead to silence this warning:
`arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension [-Wnull-pointer-arithmetic]`
-rw-r--r-- | external/lib/heap/dlmalloc/dlmalloc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/external/lib/heap/dlmalloc/dlmalloc.c b/external/lib/heap/dlmalloc/dlmalloc.c index 5f4181f5..96a26c68 100644 --- a/external/lib/heap/dlmalloc/dlmalloc.c +++ b/external/lib/heap/dlmalloc/dlmalloc.c @@ -2784,7 +2784,7 @@ static int has_segment_link(mstate m, msegmentptr ss) { noncontiguous segments are added. */ #define TOP_FOOT_SIZE\ - (align_offset(chunk2mem(0))+pad_request(sizeof(struct malloc_segment))+MIN_CHUNK_SIZE) + (align_offset(/*chunk2mem(0)*/TWO_SIZE_T_SIZES)+pad_request(sizeof(struct malloc_segment))+MIN_CHUNK_SIZE) /* ------------------------------- Hooks -------------------------------- */ |