The "raise" was missing, but that only revealed more problems of this
loop.

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

Reported-by: Ralf Ramsauer <[email protected]>
Signed-off-by: Jan Kiszka <[email protected]>
---
 tools/jailhouse-cell-linux | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/jailhouse-cell-linux b/tools/jailhouse-cell-linux
index 8d528c1..2978c2c 100755
--- a/tools/jailhouse-cell-linux
+++ b/tools/jailhouse-cell-linux
@@ -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:
@@ -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)
 
-- 
2.1.4

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to