diff options
author | Nicolas Boichat <drinkcat@chromium.org> | 2018-04-09 11:18:15 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-05-07 20:45:54 -0700 |
commit | 6e8cbe40eea777aeaeffe0fa0781a0a5d1763a4d (patch) | |
tree | d229d77bb060be8ba34d4bf94d257ac035c89c26 /common/keyboard_8042.c | |
parent | c24d480d90699bf6aaf534d66dc48513d867bdd0 (diff) | |
download | chrome-ec-6e8cbe40eea777aeaeffe0fa0781a0a5d1763a4d.tar.gz |
shared_mem: Assert that shared memory size is large enough
We add a configuration option to set the minimum shared memory
size (CONFIG_SHAREDMEM_MINIMUM_SIZE), so that the link will fail
if there is not enough IRAM left.
Also, we add 2 macros around shared_mem_acquire, that check, at
build time, that the shared memory size is sufficient for the
allocation:
- SHARED_MEM_ACQUIRE_CHECK should be used instead of
shared_mem_acquire, when size is known in advance.
- SHARED_MEM_CHECK_SIZE should be used when only a maximum size
is known.
This does not account for "jump tags" that boards often add on
jump from RO to RW. Luckily, RW usually does not do verification,
and does not need as much shared memory.
BRANCH=none
BUG=chromium:739771
TEST=make buildall -j, no error
Change-Id: Ic4c72938affe65fe8f8bc17ee5111c1798fc536f
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1002713
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common/keyboard_8042.c')
-rw-r--r-- | common/keyboard_8042.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/common/keyboard_8042.c b/common/keyboard_8042.c index b18be07649..91d640fde8 100644 --- a/common/keyboard_8042.c +++ b/common/keyboard_8042.c @@ -1052,7 +1052,7 @@ static int command_keyboard_log(int argc, char **argv) if (i) { if (!kblog_buf) { - int rv = shared_mem_acquire( + int rv = SHARED_MEM_ACQUIRE_CHECK( sizeof(*kblog_buf) * MAX_KBLOG, (char **)&kblog_buf); if (rv != EC_SUCCESS) |