[U-Boot] [PATCH] fix get_ram_size memory corruption

Wolfgang Denk wd at denx.de
Tue Oct 21 13:51:09 CEST 2014


Dear Gerd Hoffmann,

In message <1413887467-18799-1-git-send-email-kraxel at redhat.com> you wrote:
> base[0] is saved, but never restored.
> 
> Test case:  Start u-boot in qemu, using vexpress-a9 emulation.
> qemu places the fdt at the start of ram, as a service for the
> guest.  Trying to pick it up there by setting fdt_addr
> accordingly fails because the fdt magic cookie is gone (zeroed
> out) after calling get_ram_size.
> 
> Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>
> ---
>  common/memsize.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

When submitting an updated version of the patch, you are supposed to
mark it as such in the Subject, and to provide a change log; please
see [1] for details.

[1] http://www.denx.de/wiki/view/U-Boot/Patches#Sending_updated_patch_versions


It seems I cannot reproduce the problem here.

Test 1:  Board = TQM5200S running U-Boot 2014.10-rc2-00274-gf9860cf

=> md 0 4
00000000: bc193d2c 0783d3c7 18688dbf c3c7c30f    ..=,.....h......
=> mw 0 27051956
=> reset
...
=> md 0 4
00000000: 27051956 0783d3c7 18688dbf c3c7c30f    '..V.....h......
=> mm 0                 
00000000: 27051956 ? deadbeef
00000004: 0783d3c7 ? affeaffe
00000008: 18688dbf ? 27051956
0000000c: c3c7c30f ? deadc0de
00000010: 3d6b3f3d ? .
=> md 0 4
00000000: deadbeef affeaffe 27051956 deadc0de    ........'..V....
=>  md 0 4
00000000: deadbeef affeaffe 27051956 deadc0de    ........'..V....

Test 2:  Board = lite5200b running U-Boot 2011.09-00282-gd8fffa0

=> md 0 4
00000000: b75d351d 77fe2cf5 4ba0ebeb 896baaae    .]5.w.,.K....k..
=> mm 0
00000000: b75d351d ? 12345678
00000004: 77fe2cf5 ? 87654321
00000008: 4ba0ebeb ? 24681357
0000000c: 896baaae ? 86427531
00000010: 53e7f1fe ? .
=> md 0 4  
00000000: 12345678 87654321 24681357 86427531    .4Vx.eC!$h.W.Bu1
=> reset
...
=> md 0 4
00000000: 12345678 87654321 24681357 86427531    .4Vx.eC!$h.W.Bu1



I cannot see any memory corruption.  If I understand you correctly,
the contents of address 0x00000000 should be overwritten here?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
... not meant for the weak-at-heart: /^(?=.*one)(?=.*two)/
If you can follow that, you can use it.
          - Randal L. Schwartz in <ukpw67rhl3.fsf at julie.teleport.com>


More information about the U-Boot mailing list