summaryrefslogtreecommitdiff
path: root/src/lib/coreboot_table.c
diff options
context:
space:
mode:
authorRonald G. Minnich <rminnich@gmail.com>2017-01-17 23:20:48 -0800
committerRonald G. Minnich <rminnich@gmail.com>2017-01-20 20:52:12 +0100
commit23bb036dcb76c30efa708f09a96184583cc367d1 (patch)
treef6712d7aa606ade014ace625a8785c264837648e /src/lib/coreboot_table.c
parent5c765ceff9060d11e7b3b712528ad65ba0149dac (diff)
lb_tables: make lb_mainboard and lb_strings record sizes 64-bit aligned
They were sized to 32-bit alignment, this grows them to 64 bit-aligned. Change-Id: I494b942c4866a7912fb48a53f9524db20ac53a8c Signed-off-by: Ronald G. Minnich <rminnich@gmail.com> Reviewed-on: https://review.coreboot.org/18165 Tested-by: build bot (Jenkins) Tested-by: Raptor Engineering Automated Test Stand <noreply@raptorengineeringinc.com> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com>
Diffstat (limited to 'src/lib/coreboot_table.c')
-rw-r--r--src/lib/coreboot_table.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c
index f8da6580cb..332d1d5010 100644
--- a/src/lib/coreboot_table.c
+++ b/src/lib/coreboot_table.c
@@ -46,6 +46,7 @@
#if CONFIG_ARCH_X86
#include <cpu/x86/mtrr.h>
#endif
+#include <commonlib/helpers.h>
static struct lb_header *lb_table_init(unsigned long addr)
{
@@ -348,10 +349,9 @@ static struct lb_mainboard *lb_mainboard(struct lb_header *header)
mainboard = (struct lb_mainboard *)rec;
mainboard->tag = LB_TAG_MAINBOARD;
- mainboard->size = (sizeof(*mainboard) +
+ mainboard->size = ALIGN_UP(sizeof(*mainboard) +
strlen(mainboard_vendor) + 1 +
- strlen(mainboard_part_number) + 1 +
- 3) & ~3;
+ strlen(mainboard_part_number) + 1, 8);
mainboard->vendor_idx = 0;
mainboard->part_number_idx = strlen(mainboard_vendor) + 1;
@@ -402,7 +402,7 @@ static void lb_strings(struct lb_header *header)
rec = (struct lb_string *)lb_new_record(header);
len = strlen(strings[i].string);
rec->tag = strings[i].tag;
- rec->size = (sizeof(*rec) + len + 1 + 3) & ~3;
+ rec->size = ALIGN_UP(sizeof(*rec) + len + 1, 8);
memcpy(rec->string, strings[i].string, len+1);
}