Richard Spiegel has uploaded this change for review. ( https://review.coreboot.org/29344
Change subject: cbfs: Get rid of void pointer math ......................................................................
cbfs: 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=none.
Change-Id: I1bbdc9499d257c5051fd7a86ca8b5c68bbf2e81d Signed-off-by: Richard Spiegel richard.spiegel@silverbackltd.com --- M payloads/coreinfo/cbfs_module.c M util/cbfstool/cbfs_image.c 2 files changed, 3 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/44/29344/1
diff --git a/payloads/coreinfo/cbfs_module.c b/payloads/coreinfo/cbfs_module.c index 275c84e..6f40081 100644 --- a/payloads/coreinfo/cbfs_module.c +++ b/payloads/coreinfo/cbfs_module.c @@ -69,7 +69,7 @@ return NULL; if (f->magic == LARCHIVE_MAGIC) return f; - f = (void *)f + ntohl(header->align); + f = (void *)(f + ntohl(header->align)); } }
diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c index 74572a9..7abedea 100644 --- a/util/cbfstool/cbfs_image.c +++ b/util/cbfstool/cbfs_image.c @@ -723,8 +723,8 @@
len = addr_next - addr - min_entry_size; /* keep space for master header pointer */ - if ((void *)entry + min_entry_size + len > buffer_get(&image->buffer) + - buffer_size(&image->buffer) - sizeof(int32_t)) { + if ((void *)(entry + min_entry_size + len) > buffer_get(&image->buffer) + + buffer_size(&image->buffer) - sizeof(int32_t)) { len -= sizeof(int32_t); } cbfs_create_empty_entry(entry, CBFS_COMPONENT_NULL, len, "");