From: Olivier Houchard Date: Sat, 15 Dec 2018 23:58:28 +0000 (+0100) Subject: MINOR: pools: Cast to volatile int * instead of int *. X-Git-Tag: v1.9-dev11~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=51e474136b6c53a64486a60251a33cce85662b57;p=thirdparty%2Fhaproxy.git MINOR: pools: Cast to volatile int * instead of int *. When using DEBUG_MEMORY_POOLS, when we want to crash, instead of using *(int *)0 = 0, use *(volatile int *)0 = 0, or clang will just translate it to a nop, instead of dereferencing 0. --- diff --git a/include/common/memory.h b/include/common/memory.h index 7e7d30b86f..9c54422a2f 100644 --- a/include/common/memory.h +++ b/include/common/memory.h @@ -475,7 +475,7 @@ static inline void pool_free(struct pool_head *pool, void *ptr) #ifdef DEBUG_MEMORY_POOLS /* we'll get late corruption if we refill to the wrong pool or double-free */ if (*POOL_LINK(pool, ptr) != (void *)pool) - *(int *)0 = 0; + *(volatile int *)0 = 0; #endif #ifndef DEBUG_UAF /* normal pool behaviour */