mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-12 19:04:59 +00:00
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>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user