[coreboot] [v2] r4198 - trunk/coreboot-v2/util/cbfstool/tools

svn at coreboot.org svn at coreboot.org
Thu Apr 23 20:46:33 CEST 2009


Author: myles
Date: 2009-04-23 20:46:32 +0200 (Thu, 23 Apr 2009)
New Revision: 4198

Modified:
   trunk/coreboot-v2/util/cbfstool/tools/cbfs-mkpayload.c
Log:
Fix an uninitialized variable.  If it didn't end up being zero it sometimes
caused a seg fault, sometimes executed somewhere else.  Also add an error if
the algorithm is unknown.

Signed-off-by: Myles Watson <mylesgw at gmail.com>
Acked-by: Ward Vandewege <ward at gnu.org>


Modified: trunk/coreboot-v2/util/cbfstool/tools/cbfs-mkpayload.c
===================================================================
--- trunk/coreboot-v2/util/cbfstool/tools/cbfs-mkpayload.c	2009-04-23 17:01:37 UTC (rev 4197)
+++ trunk/coreboot-v2/util/cbfstool/tools/cbfs-mkpayload.c	2009-04-23 18:46:32 UTC (rev 4198)
@@ -191,7 +191,7 @@
 int main(int argc, char **argv)
 {
 	void (*compress) (char *, int, char *, int *);
-	int algo;
+	int algo = CBFS_COMPRESS_NONE;
 
 	char *output = NULL;
 	char *input = NULL;
@@ -251,6 +251,9 @@
 	case CBFS_COMPRESS_LZMA:
 		compress = lzma_compress;
 		break;
+	default:
+		fprintf(stderr, "E: Unknown compression algorithm %d!\n", algo);
+		return -1;
 	}
 
 	osize = parse_elf(buffer, &obuffer, algo, compress);





More information about the coreboot mailing list