[coreboot-gerrit] New patch to review for coreboot: cbfstool: Don't use le32toh(), it's non-standard
Nico Huber (nico.h@gmx.de)
gerrit at coreboot.org
Tue Jan 17 13:06:52 CET 2017
Nico Huber (nico.h at gmx.de) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18157
-gerrit
commit f3f96260038761b56b0a172f4b55713f7b593470
Author: Nico Huber <nico.huber at secunet.com>
Date: Tue Jan 17 13:01:25 2017 +0100
cbfstool: Don't use le32toh(), it's non-standard
It's a BSD function, also, we missed to include `endian.h`.
Just including `endian.h` doesn't fix the problem for everyone.
Instead of digging deeper, just use our own endian-conversion from
`commonlib`.
Change-Id: Ia781b2258cafb0bcbe8408752a133cd28a888786
Reported-by: Werner Zeh <werner.zeh at siemens.com>
Signed-off-by: Nico Huber <nico.huber at secunet.com>
---
util/cbfstool/cbfstool.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c
index 9b5343e..cc31751 100644
--- a/util/cbfstool/cbfstool.c
+++ b/util/cbfstool/cbfstool.c
@@ -30,6 +30,7 @@
#include "fit.h"
#include "partitioned_file.h"
#include <commonlib/fsp.h>
+#include <commonlib/endian.h>
#define SECTION_WITH_FIT_TABLE "BOOTBLOCK"
@@ -445,8 +446,8 @@ static int cbfstool_convert_raw(struct buffer *buffer,
decompressed_size = buffer->size;
if (param.precompression) {
- param.compression = le32toh(((uint32_t *)buffer->data)[0]);
- decompressed_size = le32toh(((uint32_t *)buffer->data)[1]);
+ param.compression = read_le32(buffer->data);
+ decompressed_size = read_le32(buffer->data + sizeof(uint32_t));
compressed_size = buffer->size - 8;
compressed = malloc(compressed_size);
if (!compressed)
More information about the coreboot-gerrit
mailing list