[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] fw_cfg: fix the life cycle and the name of "qem
From: |
Stefano Garzarella |
Subject: |
Re: [Qemu-devel] [PATCH] fw_cfg: fix the life cycle and the name of "qemu_extra_params_fw" |
Date: |
Mon, 21 Jan 2019 16:14:08 +0100 |
User-agent: |
NeoMutt/20180716 |
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 <address@hidden>
> Cc: Markus Armbruster <address@hidden>
> Cc: Philippe Mathieu-Daudé <address@hidden>
> Fixes: 19bcc4bc3213e78c303ad480a7a578f62258252d
> Signed-off-by: Laszlo Ersek <address@hidden>
> ---
> hw/nvram/fw_cfg.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
Reviewed-by: Stefano Garzarella <address@hidden>