Skip to contentSkip to conversation

fdt: Check if the FDT address is configured

PATCH New Marek Vasut 3 participants 6 messages Sep 5, 2012 – Sep 15, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fdt: Check if the FDT address is configured

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.

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

common/cmd_fdt.c +12 -1
index 9a5c53e..e2225c4 100644
@@ -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;
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/1 fdt: Check if the FDT address is configured

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.

Quoted 35 lines · Marek Vasut

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.

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

common/cmd_fdt.c +9 -0
index 9a5c53e..e2225c4 100644
@@ -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;

common/cmd_fdt.c int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) · line 134

Quoted 10 lines
common/cmd_fdt.c +3 -1
+	}
+
 	/*
 	 * 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

#2 lore raw

PATCH 1/1 fdt: Check if the FDT address is configured

Dear Jerry Van Baren,

Quoted 6 lines

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.

It's a fix, I'd say queue it for current release. Only fixes go into current release after MW closed.

Thanks Jerry!

Quoted 51 lines · Marek Vasut
Quoted 50 lines

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.

---

 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.

common/cmd_fdt.c +11 -0
index 9a5c53e..e2225c4 100644
@@ -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
common/cmd_fdt.c +1 -1
 	 */
 
-	} else if (strncmp(argv[1], "mo", 2) == 0) {
+	if (strncmp(argv[1], "mo", 2) == 0) {
Quoted 6 lines

common/cmd_fdt.c int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) · line 134

Quoted 3 lines
common/cmd_fdt.c +0 -0
 		struct fdt_header *newaddr;
 		int  len;
 		int  err;

Thanks,
gvb

Best regards,
Marek Vasut

#3 lore raw

PATCH 1/1 fdt: Check if the FDT address is configured

Quoted 11 lines · Marek Vasut

Dear Jerry Van Baren,

Quoted 6 lines

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.

It's a fix, I'd say queue it for current release. Only fixes go into current release after MW closed.

I second what Marek says, this is a bugfix, so lets get it into the release. Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120913/94a4eaa0/attachment.pgp>
#4 lore raw

PATCH 1/1 fdt: Check if the FDT address is configured

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 11 lines · Tom Rini
Quoted 10 lines · Marek Vasut

Dear Jerry Van Baren,

Quoted 7 lines

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.

Quoted 5 lines
Quoted 2 lines

It's a fix, I'd say queue it for current release. Only fixes go into current release after MW closed.

I second what Marek says, this is a bugfix, so lets get it into the release. Thanks!

OK, will do.

Thanks,
gvb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQEcBAEBAgAGBQJQUlsqAAoJEGOcKeGailWqg5QH/1MaQYApeanym3uyMEC4Mjm8 Yc+Tjozb6l3UbnptMLdsH5WT+BexrcyVn8YsgkSCELtTByKPDZIHIQH7KFfttCd5 ZzU/roLZbE0fJmlzaTcSI9fL4+I4ZhgSGhRneQH6zsejOhWuxM0Jv7k43cTk3g0K 75ItdSHc9g7QB1zd0r6HMw7cEKOni4nbzv/ZimHvFgJDo1pUCr1Myee6o7DucqcO 3fMEx8HDH7VW3HFepJb1yN3LI1FIeNc3BBD5rbaVOyTmg5qnbmNa9kEiOGXxmuDA tAoOo8IraN63XULYXCEpgIrxJ6pb8c7ULdkHyPw2YfEDvgGixDW8HbAa0aqfm9A= =mvwF
-----END PGP SIGNATURE-----

#5 lore raw

PATCH 1/1 fdt: Check if the FDT address is configured

In reply to Marek Vasut
Quoted 10 lines · Marek Vasut

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.

Applied and sent a pull request to Tom Rini.

Thanks,
gvb