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

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

On Tue, Apr 29, 2014 at 03:16:02PM -0400, Michael D. Burkey wrote:
> 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>

Applied, thanks

Sascha

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

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
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-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

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-29 19:16 [PATCH 1/1] Fix bug in export 64 bit unsigned environment variable Michael D. Burkey
2014-04-30  6:56 ` Sascha Hauer
  -- strict thread matches above, loose matches on Subject: below --
2014-04-10 20:16 Michael D. Burkey

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