public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Jerry Van Baren <gvb.uboot@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] fdt: Check if the FDT address is configured
Date: Wed, 12 Sep 2012 21:48:17 -0400	[thread overview]
Message-ID: <50513B61.2050509@gmail.com> (raw)
In-Reply-To: <1346826884-12829-1-git-send-email-marex@denx.de>

Hi Marek,

I'll queue this up this weekend.

The merge window for v2012.10 closed September 18.  Unless there is an
overriding urgency, the patch will go into the following release.

On 09/05/2012 02:34 AM, Marek Vasut wrote:
> In case the "fdt addr" command wasn't ran yet and any other "fdt"
> subcommand was issued, the system crashed due to NULL pointer being
> used.
> 
> This is caused by "fdt addr" command setting up a pointer to the
> FDT memory location. Prior issuing "fdt addr", the pointer is NULL
> so calling any other subcommands crashed the u-boot.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Simon Glass <sjg@chromium.org>
> ---
>  common/cmd_fdt.c |   13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> Note: Damn, I'm falling asleep already :-( I hope the text above at
>       least makes sense though.
> 
> diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c
> index 9a5c53e..e2225c4 100644
> --- a/common/cmd_fdt.c
> +++ b/common/cmd_fdt.c
> @@ -114,10 +114,21 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
>  			}
>  		}
>  
> +		return CMD_RET_SUCCESS;
> +	}
> +
> +	if (!working_fdt) {
> +		puts(
> +			"No FDT memory address configured. Please configure\n"
> +			"the FDT address via \"fdt addr <address>\" command.\n"
> +			"Aborting!\n");
> +		return CMD_RET_FAILURE;
> +	}
> +
>  	/*
>  	 * Move the working_fdt
>  	 */
> -	} else if (strncmp(argv[1], "mo", 2) == 0) {
> +	if (strncmp(argv[1], "mo", 2) == 0) {
>  		struct fdt_header *newaddr;
>  		int  len;
>  		int  err;
> 

Thanks,
gvb

  reply	other threads:[~2012-09-13  1:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-05  6:34 [U-Boot] [PATCH] fdt: Check if the FDT address is configured Marek Vasut
2012-09-13  1:48 ` Jerry Van Baren [this message]
2012-09-13  8:30   ` Marek Vasut
2012-09-13 17:37     ` Tom Rini
2012-09-13 22:16       ` Jerry Van Baren
2012-09-15 13:41 ` Jerry Van Baren

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=50513B61.2050509@gmail.com \
    --to=gvb.uboot@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