From 808692b4f41cd1867d55663e66ff21ccdf223b7d Mon Sep 17 00:00:00 2001 From: Angel Pons Date: Mon, 28 Jun 2021 15:12:40 +0200 Subject: [PATCH] drivers/mrc_cache: Avoid `sizeof` on struct type Where applicable, use the size of the associated variable. Change-Id: Icf4f1c8fe9f54c44b041a65eb46d6ec9f9fd6367 Signed-off-by: Angel Pons Reviewed-on: https://review.coreboot.org/c/coreboot/+/55902 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Rudolph Reviewed-by: Tim Wawrzynczak --- src/drivers/mrc_cache/mrc_cache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/drivers/mrc_cache/mrc_cache.c b/src/drivers/mrc_cache/mrc_cache.c index f97031dadd..841c97ea3d 100644 --- a/src/drivers/mrc_cache/mrc_cache.c +++ b/src/drivers/mrc_cache/mrc_cache.c @@ -486,7 +486,7 @@ static void update_mrc_cache_by_type(int type, struct update_region_file_entry entries[] = { [0] = { - .size = sizeof(struct mrc_metadata), + .size = sizeof(*new_md), .data = new_md, }, [1] = { @@ -696,7 +696,7 @@ int mrc_cache_stash_data(int type, uint32_t version, const void *data, .data_checksum = compute_ip_checksum(data, size), }; md.header_checksum = - compute_ip_checksum(&md, sizeof(struct mrc_metadata)); + compute_ip_checksum(&md, sizeof(md)); if (CONFIG(MRC_STASH_TO_CBMEM)) { /* Store data in cbmem for use in ramstage */