[U-Boot] [PATCH] image-fdt: boot_get_fdt() return value when no DTB exists

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;

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?

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

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.

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!

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
participants (3)
-
Alexey Brodkin
-
Noam Camus
-
Tom Rini