summaryrefslogtreecommitdiff
path: root/payloads
diff options
context:
space:
mode:
authorRichard Spiegel <richard.spiegel@amd.corp-partner.google.com>2018-10-29 08:01:53 -0700
committerMartin Roth <martinroth@google.com>2018-11-06 01:46:47 +0000
commitb93796d624415fdc2ba608a1bd1089cbaaf93dc0 (patch)
treee4b7e67a94e4322ff7c5b5eae8ced8553a22efff /payloads
parentdd477e9ba3f30a8ee9c7ee1625db2ec4f2c84523 (diff)
downloadcoreboot-b93796d624415fdc2ba608a1bd1089cbaaf93dc0.tar.xz
payloads/coreinfo/cbfs_module.c: Get rid of void pointer math
Pointer math with void pointers is illegal in many compilers, though it works with GCC because it assumes size of void to be 1. Change the pointers or add parenthesis to force a proper order that will not cause compile errors if compiled with a different compiler, and more importantly, don't have unsuspected side effects. BUG=b:118484178 TEST=Build coreinfo with original code, run objdump and saved output. Added modifications, build coreinfo again, run objdump again, compared objdump outputs. Change-Id: I1bbdc9499d257c5051fd7a86ca8b5c68bbf2e81d Signed-off-by: Richard Spiegel <richard.spiegel@silverbackltd.com> Reviewed-on: https://review.coreboot.org/29344 Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'payloads')
-rw-r--r--payloads/coreinfo/cbfs_module.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/payloads/coreinfo/cbfs_module.c b/payloads/coreinfo/cbfs_module.c
index 275c84e986..6a04879440 100644
--- a/payloads/coreinfo/cbfs_module.c
+++ b/payloads/coreinfo/cbfs_module.c
@@ -69,7 +69,7 @@ static struct cbfile *getfile(struct cbfile *f)
return NULL;
if (f->magic == LARCHIVE_MAGIC)
return f;
- f = (void *)f + ntohl(header->align);
+ f = (struct cbfile *)((u8 *)f + ntohl(header->align));
}
}
@@ -81,8 +81,8 @@ static struct cbfile *firstfile(void)
static struct cbfile *nextfile(struct cbfile *f)
{
- f = (void *)f + ALIGN(ntohl(f->len) + ntohl(f->offset),
- ntohl(header->align));
+ f = (struct cbfile *)((u8 *)f + ALIGN(ntohl(f->len) + ntohl(f->offset),
+ ntohl(header->align)));
return getfile(f);
}