CLEANUP: cache: use read_u32/write_u32 to access the cache entry's hash
authorWilly Tarreau <w@1wt.eu>
Tue, 25 Feb 2020 08:35:07 +0000 (09:35 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 25 Feb 2020 08:35:07 +0000 (09:35 +0100)
commit8b5075806d551a7a20693b5edb76a6e8d2fe1816
treef35e0100ba042ac7ed5250bfea4b405a89c4b41c
parent2b9f0664d601188f074f14c8844bc05d5cdeebff
CLEANUP: cache: use read_u32/write_u32 to access the cache entry's hash

Enabling strict aliasing fails on the cache's hash which is a series of
20 bytes cast as u32. And in practice it could even fail on some archs
if the http_txn didn't guarantee the hash was properly aligned. Let's
use read_u32() to read the value and write_u32() to set it, this makes
sure the compiler emits the correct code to access these and knows about
the intentional aliasing.
src/cache.c
src/http_ana.c