[U-Boot-Users] problems with spartan3, spartan2 and virtex2 relocation of null pointers

I notice that in several places the spartan2/3 and virtex2 download code tests the fn->pre and fn->post pointers for a null and skips calling them if they are null.
The relocation code that moves the pointers never checks them for null and happily adds reloc_offset to the null pointers making non-null ones and leading to a crash when the code tries to call them.
Does it make more sense to remove the checks and always call the functions (assuming everybody using these bits has defined at least a stub for these), or does it make more sense to test the pointers at reloc time and fix all the reloc functions?

In message c166aa9f0607151744h32ef3f75h270d0fe8562582c3@mail.gmail.com you wrote:
The relocation code that moves the pointers never checks them for null and happily adds reloc_offset to the null pointers making non-null ones and leading to a crash when the code tries to call them.
Argh...
Does it make more sense to remove the checks and always call the functions (assuming everybody using these bits has defined at least a stub for these), or does it make more sense to test the pointers at reloc time and fix all the reloc functions?
Relocation should be performed as expected, i. e. here the relocation code should be fixed.
Best regards,
Wolfgang Denk

On 7/16/06, Wolfgang Denk wd@denx.de wrote:
Relocation should be performed as expected, i. e. here the relocation code should be fixed.
Patch is attached to check the pointers that are allowed to be null and relocate them only if non-null.
CHANGELOG * fix relocation of null pointers in virtex2.c spartan2.c and spartan3.c Patch by Andrew Dyer amdyer@gmail.com July 16, 2006
Signed-off-by: Andrew Dyer amdyer@gmail.com
participants (2)
-
Andrew Dyer
-
Wolfgang Denk