diff options
author | Julius Werner <jwerner@chromium.org> | 2022-07-07 16:20:48 -0700 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-07-09 11:58:37 +0000 |
commit | 78a0e6cfc75cb117008d568aa0981bfc9ecce126 (patch) | |
tree | 98eaa69293c6e8ccc8895b4b32555e83e9e1ae5c | |
parent | 448322b612d57980c35ce3be06bf2cea28676914 (diff) | |
download | vboot-78a0e6cfc75cb117008d568aa0981bfc9ecce126.tar.gz |
vb2_context: Use fixed-width type for boot_mode
Using enum types in serialized data structures is dangerous, because
their width may depend on compiler settings. This patch changes the data
type for (vb2_context).boot_mode to uint8_t to make sure the struct
layout will be the same in all environments. Since we only defined boot
modes up to 5 for now (and our systems are always little endian), the
structure remains binary compatible with serializations of the previous
version (so no struct version change should be necessary).
BRANCH=none
BUG=none
TEST=make runtests
Signed-off-by: Julius Werner <jwerner@chromium.org>
Change-Id: I82bc8e665ea51adaaf1f5d94986c22bd62e58bba
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3751833
Reviewed-by: Hsuan Ting Chen <roccochen@chromium.org>
Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-by: Subrata Banik <subratabanik@chromium.org>
-rw-r--r-- | firmware/2lib/include/2api.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/firmware/2lib/include/2api.h b/firmware/2lib/include/2api.h index 785e4499..ff89a29d 100644 --- a/firmware/2lib/include/2api.h +++ b/firmware/2lib/include/2api.h @@ -412,10 +412,10 @@ struct vb2_context { */ /* - * Mutually exclusive boot mode. + * Mutually exclusive boot mode (from enum vb2_boot_mode). * This constant is initialized after calling vb2api_fw_phase1(). */ - const enum vb2_boot_mode boot_mode; + const uint8_t boot_mode; }; /* Resource index for vb2ex_read_resource() */ |