U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] image-fdt: boot_get_fdt() return value when no DTB exists
@ 2014-10-22 14:17 Noam Camus
  2014-10-22 16:48 ` Tom Rini
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Noam Camus @ 2014-10-22 14:17 UTC (permalink / raw)
  To: u-boot

From: Noam Camus <noamc@ezchip.com>

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.

Signed-off-by: Noam Camus <noamc@ezchip.com>
---
 common/image-fdt.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/image-fdt.c b/common/image-fdt.c
index 9fc7481..c142ae6 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -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;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] image-fdt: boot_get_fdt() return value when no DTB exists
  2014-10-22 14:17 [U-Boot] [PATCH] image-fdt: boot_get_fdt() return value when no DTB exists Noam Camus
@ 2014-10-22 16:48 ` Tom Rini
  2014-10-22 17:15   ` Alexey Brodkin
  2014-11-10 21:26 ` [U-Boot] " Tom Rini
  2014-12-03 18:21 ` Tom Rini
  2 siblings, 1 reply; 6+ messages in thread
From: Tom Rini @ 2014-10-22 16:48 UTC (permalink / raw)
  To: u-boot

On Wed, Oct 22, 2014 at 05:17:49PM +0300, Noam Camus wrote:

> From: Noam Camus <noamc@ezchip.com>
> 
> 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.
> 
> Signed-off-by: Noam Camus <noamc@ezchip.com>

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

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] image-fdt: boot_get_fdt() return value when no DTB exists
  2014-10-22 16:48 ` Tom Rini
@ 2014-10-22 17:15   ` Alexey Brodkin
  2014-10-22 17:33     ` Tom Rini
  0 siblings, 1 reply; 6+ messages in thread
From: Alexey Brodkin @ 2014-10-22 17:15 UTC (permalink / raw)
  To: u-boot

Hi Tom,

On Wed, 2014-10-22 at 12:48 -0400, Tom Rini wrote:
> On Wed, Oct 22, 2014 at 05:17:49PM +0300, Noam Camus wrote:
> 
> > From: Noam Camus <noamc@ezchip.com>
> > 
> > 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.
> > 
> > Signed-off-by: Noam Camus <noamc@ezchip.com>
> 
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] image-fdt: boot_get_fdt() return value when no DTB exists
  2014-10-22 17:15   ` Alexey Brodkin
@ 2014-10-22 17:33     ` Tom Rini
  0 siblings, 0 replies; 6+ messages in thread
From: Tom Rini @ 2014-10-22 17:33 UTC (permalink / raw)
  To: u-boot

On Wed, Oct 22, 2014 at 05:15:07PM +0000, Alexey Brodkin wrote:
> Hi Tom,
> 
> On Wed, 2014-10-22 at 12:48 -0400, Tom Rini wrote:
> > On Wed, Oct 22, 2014 at 05:17:49PM +0300, Noam Camus wrote:
> > 
> > > From: Noam Camus <noamc@ezchip.com>
> > > 
> > > 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.
> > > 
> > > Signed-off-by: Noam Camus <noamc@ezchip.com>
> > 
> > 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.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] image-fdt: boot_get_fdt() return value when no DTB exists
  2014-10-22 14:17 [U-Boot] [PATCH] image-fdt: boot_get_fdt() return value when no DTB exists Noam Camus
  2014-10-22 16:48 ` Tom Rini
@ 2014-11-10 21:26 ` Tom Rini
  2014-12-03 18:21 ` Tom Rini
  2 siblings, 0 replies; 6+ messages in thread
From: Tom Rini @ 2014-11-10 21:26 UTC (permalink / raw)
  To: u-boot

On Wed, Oct 22, 2014 at 05:17:49PM +0300, Noam Camus wrote:

> From: Noam Camus <noamc@ezchip.com>
> 
> 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.
> 
> Signed-off-by: Noam Camus <noamc@ezchip.com>

Applied to u-boot/master, thanks!

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] image-fdt: boot_get_fdt() return value when no DTB exists
  2014-10-22 14:17 [U-Boot] [PATCH] image-fdt: boot_get_fdt() return value when no DTB exists Noam Camus
  2014-10-22 16:48 ` Tom Rini
  2014-11-10 21:26 ` [U-Boot] " Tom Rini
@ 2014-12-03 18:21 ` Tom Rini
  2 siblings, 0 replies; 6+ messages in thread
From: Tom Rini @ 2014-12-03 18:21 UTC (permalink / raw)
  To: u-boot

On Wed, Oct 22, 2014 at 05:17:49PM +0300, Noam Camus wrote:

> From: Noam Camus <noamc@ezchip.com>
> 
> 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.
> 
> Signed-off-by: Noam Camus <noamc@ezchip.com>

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.

Reported-by: Bill Pringlemeir <bpringlemeir@nbsps.com>
Reported-by: Pantelis Antoniou <panto@antoniou-consulting.com>
Confirmed-by: Bill Pringlemeir <bpringlemeir@nbsps.com>
Signed-off-by: Tom Rini <trini@ti.com>

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-12-03 18:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-22 14:17 [U-Boot] [PATCH] image-fdt: boot_get_fdt() return value when no DTB exists Noam Camus
2014-10-22 16:48 ` Tom Rini
2014-10-22 17:15   ` Alexey Brodkin
2014-10-22 17:33     ` Tom Rini
2014-11-10 21:26 ` [U-Boot] " Tom Rini
2014-12-03 18:21 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox