summaryrefslogtreecommitdiff
path: root/src/security/vboot/vbnv_flash.c
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2023-01-12 11:29:57 +0100
committerArthur Heymans <arthur@aheymans.xyz>2023-01-13 08:25:33 +0000
commit61ef0e4aa564df122283764056bf1e06a7b16cec (patch)
tree33ed61f1fdf16417c784fe206d4bd10cb15160d1 /src/security/vboot/vbnv_flash.c
parent8f9c1535a42f20ee7df190cfcabe4644d5a22068 (diff)
security/vboot: Check RW_NVRAM at buildtime
This avoids runtime failures of lacking a RW_NVRAM section in fmap or one having a size too small. Change-Id: I3415bd719428a23b21210eb2176dbe15fa44eb9c Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/71868 Reviewed-by: Paul Menzel <paulepanter@mailbox.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Diffstat (limited to 'src/security/vboot/vbnv_flash.c')
-rw-r--r--src/security/vboot/vbnv_flash.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/security/vboot/vbnv_flash.c b/src/security/vboot/vbnv_flash.c
index f39ad4f244..8a4fd09981 100644
--- a/src/security/vboot/vbnv_flash.c
+++ b/src/security/vboot/vbnv_flash.c
@@ -3,6 +3,7 @@
#include <commonlib/region.h>
#include <console/console.h>
#include <fmap.h>
+#include <fmap_config.h>
#include <string.h>
#include <vb2_api.h>
#include <security/vboot/vboot_common.h>
@@ -44,6 +45,9 @@ static inline int can_overwrite(uint8_t current, uint8_t new)
return (current & new) == new;
}
+_Static_assert(FMAP_SECTION_RW_NVRAM_SIZE >= BLOB_SIZE,
+ "RW_NVRAM FMAP section not present or too small");
+
static int init_vbnv(void)
{
struct vbnv_flash_ctx *ctx = &vbnv_flash;