Skip to content

Commit

Permalink
tools: Fix silent breakage of DTBNode parsing in Linux loader
Browse files Browse the repository at this point in the history
The "raise" was missing, but that only revealed more problems of this
loop.

Fixes: 077e62e ("tools: Add ARM and ARM64 support to Linux loader
                      script")

Reported-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
  • Loading branch information
jan-kiszka committed Nov 28, 2016
1 parent d57f3fd commit 069a584
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tools/jailhouse-cell-linux
Expand Up @@ -131,8 +131,7 @@ class DTBNode:
children = []
properties = []

token = 0
while token != OF_DT_END_NODE:
while True:
(token,) = struct.unpack_from('>I', blob[length:])
length += 4
if token == OF_DT_BEGIN_NODE:
Expand All @@ -143,8 +142,10 @@ class DTBNode:
(prop, prop_length) = DTBProperty.parse(blob[length:], strings)
length += prop_length
properties.append(prop)
elif token == OF_DT_END_NODE:
break
else:
RuntimeError('Invalid DTB')
raise RuntimeError('Invalid DTB')

return (DTBNode(name, children, properties, strings), length)

Expand Down

0 comments on commit 069a584

Please sign in to comment.