
On 6/7/20 4:02 PM, Heinrich Schuchardt wrote:
Am June 7, 2020 1:45:53 PM UTC schrieb Simon Glass sjg@chromium.org:
Hi Heinrich,
On Thu, 4 Jun 2020 at 11:28, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
assert() only works in debug mode. So checking a successful memory allocation should not use assert().
Reviewed-by: Simon Glass sjg@chromium.org
What sort of environment are you using that returns NULL in this case?
You will get NULL here if mmap() fails. This should happen if your machine has less then 128 MiB left over or you increase the RAM size of the sandbox.
For testing I suggest you increase the sandbox memory size beyond the RAM and swap size of your computer.
Best regards
Heinrich
An excessive RAM sandbox w/o the patch:
$ ./u-boot Segmentation fault
with the patch
$ ./u-boot Out of memory
Best regards
Heinrich
Regards, Simon
Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de
arch/sandbox/cpu/state.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Applied to u-boot-dm/next, thanks! Applied to u-boot-dm/next, thanks!