On Fri, Jan 18, 2019 at 11:31:52PM +0100, Laszlo Ersek wrote:
> Commit 19bcc4bc3213 ("fw_cfg: Make qemu_extra_params_fw locally",
> 2019-01-04) changed the storage duration of the "qemu_extra_params_fw"
> array from static to automatic. This broke the interface contract on the
> fw_cfg_add_file() function, which is documented as follows, in
> "include/hw/nvram/fw_cfg.h":
>
> > [...] The data referenced by the starting pointer is only linked, NOT
> > copied, into the data structure of the fw_cfg device. [...]
>
> As a result, when guest firmware fetches the "etc/boot-menu-wait" fw_cfg
> file, it now sees garbage. Fix the regression by changing the storage
> duration to allocated. (The call is reached at most once, on the realize
> path of the board-specific fw_cfg sysbus device.)
>
> While at it, clean up the name and the assignment of the object as well.
>
> Cc: Gerd Hoffmann <[email protected]>
> Cc: Markus Armbruster <[email protected]>
> Cc: Philippe Mathieu-Daudé <[email protected]>
> Fixes: 19bcc4bc3213e78c303ad480a7a578f62258252d
> Signed-off-by: Laszlo Ersek <[email protected]>
> ---
> hw/nvram/fw_cfg.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
Reviewed-by: Stefano Garzarella <[email protected]>