aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2020-03-03 10:55:37 +0100
committerLubomir Rintel <lkundrak@v3.sk>2020-03-23 18:40:24 +0100
commit9195153dbe13bc545f31aaa0b46053e7f3c46f34 (patch)
tree6a760618da5cccae0559b6453ee7d528258bacfc
parente607f82b1d6bd8b0b6be5741e66285024c5b273a (diff)
downloadopenfirmware-9195153dbe13bc545f31aaa0b46053e7f3c46f34.tar.gz
arm/linux: drop load-base off stack if not a zImage
At the time we check the zImage magic, there's ( adr len ) on the stack. Pop both off if the magic check fails. Otherwise the load of a different kind of image (such as Forth text larger than 30 bytes -- we check the length on the previous line) would leave the load base on stack which is just not nice. Fixes: 2d7dad95a1f4 ("arm/linux: ignore the size from the zImage header")
-rw-r--r--cpu/arm/linux.fth2
1 files changed, 1 insertions, 1 deletions
diff --git a/cpu/arm/linux.fth b/cpu/arm/linux.fth
index b7f6e92c..dea1ec08 100644
--- a/cpu/arm/linux.fth
+++ b/cpu/arm/linux.fth
@@ -167,7 +167,7 @@ defer place-ramdisk
: init-zimage? ( -- flag )
loaded ( adr len )
dup h# 30 < if 2drop false exit then ( adr len )
- over h# 24 + l@ h# 016f2818 <> if drop false exit then ( adr len )
+ over h# 24 + l@ h# 016f2818 <> if 2drop false exit then ( adr len )
swap >r ( len r: adr )
r@ h# 28 + l@ r@ + ( len start r: adr )
swap r> drop ( start len )