diff mbox

[U-Boot,1/6] fdt: Check error codes returned from fdtlib when loading ITB

Message ID 1345235680-16419-1-git-send-email-joe.hershberger@ni.com
State Accepted
Delegated to: Jerry Van Baren
Headers show

Commit Message

Joe Hershberger Aug. 17, 2012, 8:34 p.m. UTC
Before this patch, error codes returned from fdtlib were ignored and
continued access would cause a crash. Now just check if the image is
truncated and error if so.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---
 common/image.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Joe Hershberger Oct. 4, 2012, 5:38 p.m. UTC | #1
Hi Jerry,

On Fri, Aug 17, 2012 at 3:34 PM, Joe Hershberger <joe.hershberger@ni.com> wrote:
> Before this patch, error codes returned from fdtlib were ignored and
> continued access would cause a crash. Now just check if the image is
> truncated and error if so.
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> ---

What's the progress on this series?  I know Mike didn't like the last
patch (6 of 6), but the first 5 should be good to go.  I'd like them
to be in the 2012.10 release.

Are you able to apply them through your branch?  Or maybe ack and go
through Tom?

Thanks,
-Joe
Jerry Van Baren Oct. 8, 2012, 11:45 p.m. UTC | #2
Hi Joe, Tom,

On 10/04/2012 01:38 PM, Joe Hershberger wrote:
> Hi Jerry,
> 
> On Fri, Aug 17, 2012 at 3:34 PM, Joe Hershberger <joe.hershberger@ni.com> wrote:
>> Before this patch, error codes returned from fdtlib were ignored and
>> continued access would cause a crash. Now just check if the image is
>> truncated and error if so.
>>
>> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
>> ---
> 
> What's the progress on this series?  I know Mike didn't like the last
> patch (6 of 6), but the first 5 should be good to go.  I'd like them
> to be in the 2012.10 release.
> 
> Are you able to apply them through your branch?  Or maybe ack and go
> through Tom?

The first 5 of the series look good to me.  #1 and #5 touch image.c
which is on the fringe of my FDT mandate.

Tom, do you want to pick the changes up?  Unless you object, I'll apply
them to the fdt subrepo and submit a pull request when the window opens.

> Thanks,
> -Joe

Thanks,
gvb
Tom Rini Oct. 8, 2012, 11:51 p.m. UTC | #3
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/08/12 16:45, Jerry Van Baren wrote:
> Hi Joe, Tom,
> 
> On 10/04/2012 01:38 PM, Joe Hershberger wrote:
>> Hi Jerry,
>> 
>> On Fri, Aug 17, 2012 at 3:34 PM, Joe Hershberger 
>> <joe.hershberger@ni.com> wrote:
>>> Before this patch, error codes returned from fdtlib were 
>>> ignored and continued access would cause a crash. Now just 
>>> check if the image is truncated and error if so.
>>> 
>>> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> ---
>> 
>> What's the progress on this series?  I know Mike didn't like the
>>  last patch (6 of 6), but the first 5 should be good to go.  I'd
>>  like them to be in the 2012.10 release.
>> 
>> Are you able to apply them through your branch?  Or maybe ack and
>> go through Tom?
> 
> The first 5 of the series look good to me.  #1 and #5 touch
> image.c which is on the fringe of my FDT mandate.
> 
> Tom, do you want to pick the changes up?  Unless you object, I'll 
> apply them to the fdt subrepo and submit a pull request when the 
> window opens.

Sounds fine with me so long as you're happy with the changes.

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

iQIcBAEBAgAGBQJQc2b2AAoJENk4IS6UOR1Wm+IP/0l7XzeJO2xCTzCcPmskV6v/
513G5BV+6nIlCG0UBT489bc3Rg5HWzfR+iml/SaAxmsPnRChesWRF9PQybVHFXRV
u+001a877BKfp7xqh+LApKWtjr6CqUzgCsHnpwsp66/GOTjbSkfaedJvv/SwZFGL
yQBhSnJ5PntXJRfcIZGxwMdDobOZXyq3C7niLDAF6PecCL+TQNk2L/uhuhLWU7QB
28o0cDft1lX7yyy1unGN8xUel4wDh86d3GTkzJP+uQAk7CYNJr7FTSMo1CdGqmtQ
Ubovt28fa2K0aLOQf0fTs8DSAc+3elzvsf3C5JrzZL2WYfgGC3yM53j5Ef4Te+aU
+jnkehcThE6URbLVjEtC8de5QjeDSX2HTNpAk0+PICpLQ+DSoYdXuFyCtYxF/7i5
0MH7fuWFU3evHrm+i1/0prgK9Q0HcDCYR69G8kCobMbWjJuFaEnZ0h86YDR12X+b
oUghtbYprqhsTitFtZ0N3Pfd3AsirBPTVd/SCCLz/wFcOhk4FP3YJ2sJCfK2KHDc
pqPcR6YmOjSGfD7PhllYD7Vrq3WqwzXd9mPKbVPGGG6pWp+oA2xfTaZAWzFym754
4PBe3RlnUL9MFY7DhCqb+VHIvC21Goz+xWG9BNoq7IxMshAPH7GF0U4R7cZPlD2F
FDM2wjhHxc0pvE9+JU30
=I+aj
-----END PGP SIGNATURE-----
diff mbox

Patch

diff --git a/common/image.c b/common/image.c
index 91954ac..4252e63 100644
--- a/common/image.c
+++ b/common/image.c
@@ -2818,6 +2818,11 @@  int fit_image_check_hashes(const void *fit, int image_noffset)
 		}
 	}
 
+	if (noffset == -FDT_ERR_TRUNCATED || noffset == -FDT_ERR_BADSTRUCTURE) {
+		err_msg = " error!\nCorrupted or truncated tree";
+		goto error;
+	}
+
 	return 1;
 
 error: