[coreboot-gerrit] New patch to review for coreboot: cbfs-compression-tool: catch compression failures

Patrick Georgi (pgeorgi@google.com) gerrit at coreboot.org
Mon Jan 23 09:42:12 CET 2017


Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18201

-gerrit

commit f86832a4d94f21d8668ed1d9267d248296ca2fa7
Author: Patrick Georgi <pgeorgi at chromium.org>
Date:   Mon Jan 23 09:35:44 2017 +0100

    cbfs-compression-tool: catch compression failures
    
    If compression failed, just store the uncompressed data, which is what
    cbfstool does as well.
    
    Change-Id: I67f51982b332d6ec1bea7c9ba179024fc5344743
    Signed-off-by: Patrick Georgi <pgeorgi at chromium.org>
---
 util/cbfstool/cbfscomptool.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/util/cbfstool/cbfscomptool.c b/util/cbfstool/cbfscomptool.c
index 1aa1699..9e80486 100644
--- a/util/cbfstool/cbfscomptool.c
+++ b/util/cbfstool/cbfscomptool.c
@@ -150,7 +150,12 @@ int compress(char *infile, char *outfile, char *algoname)
 		remsize -= readsz;
 	}
 
-	comp(indata, insize, outdata, &outsize);
+	if (comp(indata, insize, outdata, &outsize) == -1) {
+		outsize = insize;
+		free(outdata);
+		outdata = indata;
+		algo = &types_cbfs_compression[0];
+	}
 
 	char header[8];
 	header[0] = algo->type & 0xff;



More information about the coreboot-gerrit mailing list