summaryrefslogtreecommitdiffstats
path: root/common/startup.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2014-02-20 10:54:28 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2014-02-20 14:46:33 +0100
commit5d22cb385695dc17cb226ba63db3c2a253a56bc6 (patch)
tree6e4977757107f91efb21bf2dd7e77beba143c0b7 /common/startup.c
parent0a2a8f7059e6cb11e5d4eb882538b37f99d09ee3 (diff)
downloadbarebox-5d22cb385695dc17cb226ba63db3c2a253a56bc6.tar.gz
barebox-5d22cb385695dc17cb226ba63db3c2a253a56bc6.tar.xz
defaultenv: Align defaultenv array
The default environment buffer is an unsigned char array and thus may be unaligned. Some decompression algorithms expect the buffer to be sufficiently aligned for u32 accesses. We make this sure by copying the default env to a temporary buffer. Instead of doing this just add a __aligned(4) to the default environment. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/startup.c')
-rw-r--r--common/startup.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/common/startup.c b/common/startup.c
index 4bc5628f4a..6847b61b46 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -53,21 +53,12 @@ static int register_default_env(void)
void *defaultenv;
if (!IS_ENABLED(CONFIG_DEFAULT_COMPRESSION_NONE)) {
- void *tmp = malloc(default_environment_size);
-
- if (!tmp)
- return -ENOMEM;
-
- memcpy(tmp, default_environment, default_environment_size);
defaultenv = xzalloc(default_environment_uncompress_size);
- ret = uncompress(tmp, default_environment_size,
+ ret = uncompress(default_environment, default_environment_size,
NULL, NULL,
defaultenv, NULL, uncompress_err_stdout);
-
- free(tmp);
-
if (ret) {
free(defaultenv);
return ret;