Skip to contentSkip to conversation

image-fdt: boot_get_fdt() return value when no DTB exists

PATCH In review Noam Camus 3 participants 6 messages Oct 22, 2014 – Dec 3, 2014

lore
Share & tools
lore

Noam Camus

author
#0 lore raw

PATCH 1/1 image-fdt: boot_get_fdt() return value when no DTB exists

From: Noam Camus <[email protected]>

I believe that when no DTB is around we should return 1. This why I fixed such scenarious to not return zero anymore. Else kernel might get NULL pointer to DTB which doesn't exists.

---
 common/image-fdt.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
common/image-fdt.c +2 -2
index 9fc7481..c142ae6 100644
@@ -413,11 +413,11 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
 			}
 		} else {
 			debug("## No Flattened Device Tree\n");
-			return 0;
+			goto error;
 		}
 	} else {
 		debug("## No Flattened Device Tree\n");
-		return 0;
+		goto error;
 	}
 
 	*of_flat_tree = fdt_blob;
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/1 image-fdt: boot_get_fdt() return value when no DTB exists

Quoted 7 lines · Noam Camus

From: Noam Camus <[email protected]>

I believe that when no DTB is around we should return 1. This why I fixed such scenarious to not return zero anymore. Else kernel might get NULL pointer to DTB which doesn't exists.

While this is probably OK and not an issue, my only "what if" is, what about for appened device trees?

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141022/3e09d660/attachment.pgp>
#2 lore raw

PATCH 1/1 image-fdt: boot_get_fdt() return value when no DTB exists

Hi Tom,

Quoted 4 lines · Tom Rini
Quoted 2 lines · Noam Camus

From: Noam Camus <[email protected]>

Quoted 8 lines
Quoted 5 lines

I believe that when no DTB is around we should return 1. This why I fixed such scenarious to not return zero anymore. Else kernel might get NULL pointer to DTB which doesn't exists.

While this is probably OK and not an issue, my only "what if" is, what about for appened device trees?

Which device tree do you mean?
The one built in uImage or in FIT image?

-Alexey

#3 lore raw

PATCH 1/1 image-fdt: boot_get_fdt() return value when no DTB exists

Quoted 11 lines · Alexey Brodkin

Hi Tom,

Quoted 8 lines · Tom Rini
Quoted 6 lines · Noam Camus

From: Noam Camus <[email protected]>

I believe that when no DTB is around we should return 1. This why I fixed such scenarious to not return zero anymore. Else kernel might get NULL pointer to DTB which doesn't exists.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

While this is probably OK and not an issue, my only "what if" is, what about for appened device trees?

Which device tree do you mean?
The one built in uImage or in FIT image?

I'm talking about the allowed-by-kludgey case of a device tree being cat'd to the end of an image prior to loading.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141022/4ad80789/attachment.pgp>
#4 lore raw
In reply to Noam Camus
Quoted 7 lines · Noam Camus

From: Noam Camus <[email protected]>

I believe that when no DTB is around we should return 1. This why I fixed such scenarious to not return zero anymore. Else kernel might get NULL pointer to DTB which doesn't exists.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141110/8b1bb502/attachment.pgp>
#5 lore raw
In reply to Noam Camus
Quoted 7 lines · Noam Camus

From: Noam Camus <[email protected]>

I believe that when no DTB is around we should return 1. This why I fixed such scenarious to not return zero anymore. Else kernel might get NULL pointer to DTB which doesn't exists.

It has been found that this change breaks the case of an appended device tree file, so for the problem in question some other solution must be found.

This reverts commit c6150aaf2f2745141a7c2ceded58d7efbfeace7d.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141203/0544273a/attachment.pgp>