Attention is currently required from: Krystian Hebel. Hello Krystian Hebel,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/57072
to review the following change.
Change subject: src/lib/fmap.c: use le*toh() functions where needed ......................................................................
src/lib/fmap.c: use le*toh() functions where needed
TODO: add documentation
Change-Id: I4f6abe0d720fbc79f689a67eccab984a556ad7fa Signed-off-by: Krystian Hebel krystian.hebel@3mdeb.com --- M src/lib/fmap.c 1 file changed, 8 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/72/57072/1
diff --git a/src/lib/fmap.c b/src/lib/fmap.c index 254d787..6ff8431 100644 --- a/src/lib/fmap.c +++ b/src/lib/fmap.c @@ -8,6 +8,7 @@ #include <stddef.h> #include <string.h> #include <symbols.h> +#include <endian.h>
#include "fmap_config.h"
@@ -49,7 +50,8 @@ print_once(BIOS_DEBUG, "FMAP: Found "%s" version %d.%d at %#x.\n", fmap->name, fmap->ver_major, fmap->ver_minor, FMAP_OFFSET); print_once(BIOS_DEBUG, "FMAP: base = %#llx size = %#x #areas = %d\n", - (long long)fmap->base, fmap->size, fmap->nareas); + (long long)le64toh(fmap->base), le32toh(fmap->size), + le16toh(fmap->nareas)); fmap_print_once = 1; }
@@ -188,10 +190,10 @@ }
printk(BIOS_DEBUG, "FMAP: area %s found @ %x (%d bytes)\n", - name, area->offset, area->size); + name, le32toh(area->offset), le32toh(area->size));
- ar->offset = area->offset; - ar->size = area->size; + ar->offset = le32toh(area->offset); + ar->size = le32toh(area->size);
rdev_munmap(&fmrd, area);
@@ -226,8 +228,8 @@ if (area == NULL) return -1;
- if ((ar->offset != area->offset) || - (ar->size != area->size)) { + if ((ar->offset != le32toh(area->offset)) || + (ar->size != le32toh(area->size))) { rdev_munmap(&fmrd, area); offset += sizeof(struct fmap_area); continue;