mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/1] Fix bug in export 64 bit unsigned environment variable.
@ 2014-04-10 20:16 Michael D. Burkey
  0 siblings, 0 replies; 3+ messages in thread
From: Michael D. Burkey @ 2014-04-10 20:16 UTC (permalink / raw)
  To: barebox

(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);

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread
* [PATCH 1/1] Fix bug in export 64 bit unsigned environment variable.
@ 2014-04-29 19:16 Michael D. Burkey
  2014-04-30  6:56 ` Sascha Hauer
  0 siblings, 1 reply; 3+ messages in thread
From: Michael D. Burkey @ 2014-04-29 19:16 UTC (permalink / raw)
  To: barebox

This patch corrects exporting unsigned 64-bit environment variables.
I had left out a signed off line before.

Signed-off-by: Michael Burkey <mdburkey at gmail.com>
---


--- 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);

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-04-30  6:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-10 20:16 [PATCH 1/1] Fix bug in export 64 bit unsigned environment variable Michael D. Burkey
2014-04-29 19:16 Michael D. Burkey
2014-04-30  6:56 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox