summaryrefslogtreecommitdiff
path: root/include/update_fw.h
diff options
context:
space:
mode:
authorWei-Han Chen <stimim@google.com>2018-03-12 20:11:23 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-03-22 10:58:26 -0700
commitaab7366187e8feb3ffdb904767ffa550a44c9f2e (patch)
treedba29674bf097cd111a404e49badc8efff9a3fb8 /include/update_fw.h
parent9a8e4226c3a59ad189c3e8c7a7328c7de5fe32d7 (diff)
downloadchrome-ec-aab7366187e8feb3ffdb904767ffa550a44c9f2e.tar.gz
usb_update: check touchpad_info size at build time
Current protocol will not work if touchpad_info is more than 50 bytes. Assert this constrain at build time. BRANCH=none BUG=b:70482333 TEST=make BOARD=hammer Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I9bf163f77f14c7d475fc8a2f422ce596dc89c61e Reviewed-on: https://chromium-review.googlesource.com/958893 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Diffstat (limited to 'include/update_fw.h')
-rw-r--r--include/update_fw.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/update_fw.h b/include/update_fw.h
index 727a3012f5..e454f129bd 100644
--- a/include/update_fw.h
+++ b/include/update_fw.h
@@ -8,6 +8,7 @@
#include <stddef.h>
+#include "compile_time_macros.h"
/*
* This file contains structures used to facilitate EC firmware updates
@@ -217,6 +218,14 @@ struct touchpad_info {
} elan;
} __packed;
+/*
+ * The response message must not exceed 64 bytes.
+ * And our protocol has a 14 bytes header.
+ * So the size of `struct touchpad_info` must be less
+ * than or equal to 50 bytes
+ */
+BUILD_ASSERT(sizeof(struct touchpad_info) <= 50);
+
void fw_update_command_handler(void *body,
size_t cmd_size,
size_t *response_size);