From: John Rigby <jcrigby@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 8/9] env_nand.c: print error message and fail gracefully
Date: Tue, 12 Jan 2010 21:44:00 -0700 [thread overview]
Message-ID: <1263357841-5100-9-git-send-email-jcrigby@gmail.com> (raw)
In-Reply-To: <1263357841-5100-8-git-send-email-jcrigby@gmail.com>
From: Wolfgang Denk <wd@denx.de>
env_nand.c would crash silently if a malloc() for the environment
buffers failed; make it print an error message and fail gracefully,
i. e. use the default environment then.
Signed-off-by: Wolfgang Denk <wd@denx.de>
---
common/env_nand.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/common/env_nand.c b/common/env_nand.c
index ca631af..a5166cb 100644
--- a/common/env_nand.c
+++ b/common/env_nand.c
@@ -298,6 +298,15 @@ void env_relocate_spec (void)
tmp_env1 = (env_t *) malloc(CONFIG_ENV_SIZE);
tmp_env2 = (env_t *) malloc(CONFIG_ENV_SIZE);
+ if ((tmp_env1 == NULL) || (tmp_env2 == NULL)) {
+ puts("Can't allocate buffers for environment\n");
+ if (tmp_env1)
+ free (tmp_env1);
+ if (tmp_env2)
+ free (tmp_env2);
+ return use_default();
+ }
+
if (readenv(CONFIG_ENV_OFFSET, (u_char *) tmp_env1))
puts("No Valid Environment Area Found\n");
if (readenv(CONFIG_ENV_OFFSET_REDUND, (u_char *) tmp_env2))
--
1.6.4.2.236.gf324c
next prev parent reply other threads:[~2010-01-13 4:44 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-13 4:43 [U-Boot] [PATCH 0/9] Add support for i.MX25 SOC and TX25 board John Rigby
2010-01-13 4:43 ` [U-Boot] [PATCH 1/9] mxc_serial replace platform specific clock John Rigby
2010-01-13 4:43 ` [U-Boot] [PATCH 2/9] arm926ejs: add nand_spl boot support John Rigby
2010-01-13 4:43 ` [U-Boot] [PATCH 3/9] Add v1.1 support to nand_spl fsl nfc driver John Rigby
2010-01-13 4:43 ` [U-Boot] [PATCH 4/9] Nand mxc_nand add v1.1 controller support John Rigby
2010-01-13 4:43 ` [U-Boot] [PATCH 5/9] fec_mxc: cleanup and factor out imx27 dependencies John Rigby
2010-01-13 4:43 ` [U-Boot] [PATCH 6/9] Add support for Freescale MX25 SOC John Rigby
2010-01-13 4:43 ` [U-Boot] [PATCH 7/9] fec_mxc: add imx25 support John Rigby
2010-01-13 4:44 ` John Rigby [this message]
2010-01-13 4:44 ` [U-Boot] [PATCH 9/9] Add support for KARO TX25 board John Rigby
2010-01-13 15:26 ` Fabio Estevam
2010-01-15 15:20 ` Wolfgang Denk
2010-01-15 22:28 ` [U-Boot] [PATCH 8/9] env_nand.c: print error message and fail gracefully Scott Wood
2010-01-13 15:10 ` [U-Boot] [PATCH 4/9] Nand mxc_nand add v1.1 controller support Fabio Estevam
2010-01-13 16:50 ` John Rigby
2010-01-15 0:48 ` Fabio Estevam
2010-01-15 16:49 ` John Rigby
2010-01-15 22:36 ` Scott Wood
2010-01-15 23:32 ` John Rigby
2010-01-13 15:15 ` [U-Boot] [PATCH 3/9] Add v1.1 support to nand_spl fsl nfc driver Fabio Estevam
2010-01-15 23:13 ` Scott Wood
2010-01-15 23:30 ` John Rigby
2010-01-15 23:48 ` Scott Wood
2010-01-15 15:09 ` [U-Boot] [PATCH 0/9] Add support for i.MX25 SOC and TX25 board Wolfgang Denk
2010-01-15 15:14 ` Wolfgang Denk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1263357841-5100-9-git-send-email-jcrigby@gmail.com \
--to=jcrigby@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox