[PATCH 1/1] Fix bug in export 64 bit unsigned environment variable.

Michael D. Burkey mdburkey at gmail.com
Thu Apr 10 13:16:03 PDT 2014


(As this is the first patch I'm posting directly to the list rather
than through Sascha, feel free to yell at me if my format is wrong.)

This fixes a fairly major, trivial bug in the export_env_ull function
-- it is currently converting values to signed when it exports them.
As the import function doesn't handle signed values, this means that
any values with the msb set cannot be read back in -- which breaks
some things like passing serial # ATAG's to the kernel.

This simple (one character!) fix solves the problem.

Michael D. Burkey

-------------------------------------------------------------------------

--- a/common/env.c
+++ b/common.env.c
@@ -258,7 +258,7 @@

 void export_env_ull(const char *name, unsigned long long val)
 {
-	char *valstr = asprintf("%lld", val);
+	char *valstr = asprintf("%llu", val);

 	setenv(name, valstr);
 	export(name);



More information about the barebox mailing list