diff options
author | Patryk Duda <pdk@semihalf.com> | 2022-02-23 10:58:39 +0000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-02-28 16:27:18 +0000 |
commit | 26c9f24f5bd44d634fcda8ce1ade459de5112fc6 (patch) | |
tree | 7a63c7b0afa44e3ef4ff2afda7934892c5f2e8cf /include/panic.h | |
parent | 6f9842a69af4d42b980c16351c08b1cc2f7a1874 (diff) | |
download | chrome-ec-26c9f24f5bd44d634fcda8ce1ade459de5112fc6.tar.gz |
panic: Check panic data size during build
Add build asserts which will check if panic data structure has expected
size. This will prevent from extending panic data structure in a way
that could break compatibility with RO.
To enable check, define CONFIG_RO_PANIC_DATA_SIZE in your board.h file
with expected panic data size.
BUG=b:119131962
BRANCH=none
TEST=make -j buildall
Signed-off-by: Patryk Duda <pdk@semihalf.com>
Change-Id: I1d4b7870ce20c90755853267e1885d118ba08601
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3485136
Tested-by: Patryk Duda <patrykd@google.com>
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Commit-Queue: Patryk Duda <patrykd@google.com>
Diffstat (limited to 'include/panic.h')
-rw-r--r-- | include/panic.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/panic.h b/include/panic.h index 4976486e95..72a397cb7f 100644 --- a/include/panic.h +++ b/include/panic.h @@ -125,6 +125,10 @@ struct panic_data { uint32_t magic; /* PANIC_SAVE_MAGIC if valid */ }; +#ifdef CONFIG_RO_PANIC_DATA_SIZE +BUILD_ASSERT(sizeof(struct panic_data) == CONFIG_RO_PANIC_DATA_SIZE); +#endif + #define PANIC_DATA_MAGIC 0x21636e50 /* "Pnc!" */ enum panic_arch { PANIC_ARCH_CORTEX_M = 1, /* Cortex-M architecture */ |