Addresses in state->ram_buf must be in the low 4 GiB of the address space.
Otherwise we cannot correctly fill SMBIOS tables. This shows up in warnings
like:
WARNING: SMBIOS table_address overflow
7f752735e020
Ensure that state->ram_buf is initialized by the first invocation of
os_malloc().
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
text_base = os_find_text_base();
+ /*
+ * This must be the first invocation of os_malloc() to have
+ * state->ram_buf in the low 4 GiB.
+ */
+ ret = state_init();
+ if (ret)
+ goto err;
+
/*
* Copy argv[] so that we can pass the arguments in the original
* sequence when resetting the sandbox.
gd = &data;
gd->arch.text_base = text_base;
- ret = state_init();
- if (ret)
- goto err;
-
state = state_get_current();
if (os_parse_args(state, argc, argv))
return 1;