diff options
author | Gonglei <arei.gonglei@huawei.com> | 2014-11-25 12:38:19 +0800 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2014-11-26 12:11:27 +0100 |
commit | f3b3766899fc0a79a175a5d29d0ff427327cd34a (patch) | |
tree | a419403bd9a8d2be3737bfaabffa5ba366864964 /hw | |
parent | d1048bef9df0aacde9a54bf9b5b97a6e10950d8c (diff) | |
download | qemu-f3b3766899fc0a79a175a5d29d0ff427327cd34a.tar.gz qemu-f3b3766899fc0a79a175a5d29d0ff427327cd34a.tar.bz2 qemu-f3b3766899fc0a79a175a5d29d0ff427327cd34a.zip |
fw_cfg: fix boot order bug when dynamically modified via QOM
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 <kraxel@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/nvram/fw_cfg.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index e7ed27e242..a7122ee56b 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 */ |