diff options
author | Patrick Rudolph <siro@das-labor.org> | 2020-08-19 08:40:31 +0200 |
---|---|---|
committer | Patrick Rudolph <siro@das-labor.org> | 2020-11-03 09:11:21 +0000 |
commit | 88991caf00d3b8862bc3c1aa4497baeb67e910e6 (patch) | |
tree | 182b9056c56b2f648fab72e5f206c58f914922d1 /.clang-format | |
parent | e8e0418d984f0ba4a6754ce37d6fe8ecc7cd4a2f (diff) |
include/list.h: Add support for GCC9+
When getting the address of a structure's member that is not on
offset 0, GCC9+ assumes that the address can never be NULL. However
the code relied on the fact that it can be NULL by letting the pointer
intentionally overflow.
Manually calculate the address using uintptr_t. This allows to
gracefully terminate the list_for_each MACRO instead of crashing at the
end of the list.
Tested on qemu-system-arm:
coreboot no longer crashed in the devicetree parser and is able to boot
Linux 5.5.
Change-Id: I0d569b59a23d1269f8575fcbbe92a5a6816aa1f7
Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/44573
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to '.clang-format')
0 files changed, 0 insertions, 0 deletions