Received: from eggs.gnu.org ([2001:4830:134:3::10]:34796) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XtaoD-00024j-Vc for qemu-devel@nongnu.org; Wed, 26 Nov 2014 06:31:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xtao5-0007fR-To for qemu-devel@nongnu.org; Wed, 26 Nov 2014 06:30:57 -0500 Received: from mail-wi0-x22f.google.com ([2a00:1450:400c:c05::22f]:58094) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xtao5-0007fC-Iw for qemu-devel@nongnu.org; Wed, 26 Nov 2014 06:30:49 -0500 Received: by mail-wi0-f175.google.com with SMTP id l15so12176015wiw.14 for ; Wed, 26 Nov 2014 03:30:49 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Wed, 26 Nov 2014 12:30:38 +0100 Message-Id: <1417001439-29299-3-git-send-email-pbonzini@redhat.com> In-Reply-To: <1417001439-29299-1-git-send-email-pbonzini@redhat.com> References: <1417001439-29299-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 2/3] fw_cfg: fix boot order bug when dynamically modified via QOM List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gonglei , Gerd Hoffmann From: Gonglei When we dynamically modify boot order, the length of boot order will be changed, but we don't update s->files->f[i].size with new length. This casuse seabios read a wrong vale of qemu cfg file about bootorder. Cc: Gerd Hoffmann Cc: Paolo Bonzini Signed-off-by: Gonglei Signed-off-by: Paolo Bonzini --- hw/nvram/fw_cfg.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index e7ed27e..a7122ee 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -523,6 +523,7 @@ void *fw_cfg_modify_file(FWCfgState *s, const char *filename, void *data, size_t len) { int i, index; + void *ptr = NULL; assert(s->files); @@ -531,8 +532,10 @@ void *fw_cfg_modify_file(FWCfgState *s, const char *filename, for (i = 0; i < index; i++) { if (strcmp(filename, s->files->f[i].name) == 0) { - return fw_cfg_modify_bytes_read(s, FW_CFG_FILE_FIRST + i, - data, len); + ptr = fw_cfg_modify_bytes_read(s, FW_CFG_FILE_FIRST + i, + data, len); + s->files->f[i].size = cpu_to_be32(len); + return ptr; } } /* add new one */ -- 1.8.3.1