[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v3 6/8] fw_cfg: prohibit insertion of duplicate fw_cf
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PULL v3 6/8] fw_cfg: prohibit insertion of duplicate fw_cfg file names |
Date: |
Wed, 10 Jun 2015 08:35:29 +0200 |
From: "Gabriel L. Somlo" <address@hidden>
Exit with an error (instead of simply logging a trace event)
whenever the same fw_cfg file name is added multiple times via
one of the fw_cfg_add_file[_callback]() host-side API calls.
Signed-off-by: Gabriel Somlo <address@hidden>
Reviewed-by: Laszlo Ersek <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/nvram/fw_cfg.c | 11 ++++++-----
trace-events | 1 -
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index 0c0e15e..88481b7 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -515,18 +515,19 @@ void fw_cfg_add_file_callback(FWCfgState *s, const char
*filename,
index = be32_to_cpu(s->files->count);
assert(index < FW_CFG_FILE_SLOTS);
- fw_cfg_add_bytes_read_callback(s, FW_CFG_FILE_FIRST + index,
- callback, callback_opaque, data, len);
-
pstrcpy(s->files->f[index].name, sizeof(s->files->f[index].name),
filename);
for (i = 0; i < index; i++) {
if (strcmp(s->files->f[index].name, s->files->f[i].name) == 0) {
- trace_fw_cfg_add_file_dupe(s, s->files->f[index].name);
- return;
+ error_report("duplicate fw_cfg file name: %s",
+ s->files->f[index].name);
+ exit(1);
}
}
+ fw_cfg_add_bytes_read_callback(s, FW_CFG_FILE_FIRST + index,
+ callback, callback_opaque, data, len);
+
s->files->f[index].size = cpu_to_be32(len);
s->files->f[index].select = cpu_to_be16(FW_CFG_FILE_FIRST + index);
trace_fw_cfg_add_file(s, index, s->files->f[index].name, len);
diff --git a/trace-events b/trace-events
index 27d4ba7..9a29df7 100644
--- a/trace-events
+++ b/trace-events
@@ -195,7 +195,6 @@ ecc_diag_mem_readb(uint64_t addr, uint32_t ret) "Read
diagnostic %"PRId64"= %02x
# hw/nvram/fw_cfg.c
fw_cfg_select(void *s, uint16_t key, int ret) "%p key %d = %d"
fw_cfg_read(void *s, uint8_t ret) "%p = %d"
-fw_cfg_add_file_dupe(void *s, char *name) "%p %s"
fw_cfg_add_file(void *s, int index, char *name, size_t len) "%p #%d: %s (%zd
bytes)"
# hw/block/hd-geometry.c
--
1.8.3.1
- [Qemu-devel] [PULL v3 0/8] fw_cfg patch queue, Gerd Hoffmann, 2015/06/10
- [Qemu-devel] [PULL v3 5/8] fw_cfg: prevent selector key conflict, Gerd Hoffmann, 2015/06/10
- [Qemu-devel] [PULL v3 6/8] fw_cfg: prohibit insertion of duplicate fw_cfg file names,
Gerd Hoffmann <=
- [Qemu-devel] [PULL v3 2/8] fw_cfg: add fw_cfg_modify_i16 (update) method, Gerd Hoffmann, 2015/06/10
- [Qemu-devel] [PULL v3 4/8] fw_cfg: remove support for guest-side data writes, Gerd Hoffmann, 2015/06/10
- [Qemu-devel] [PULL v3 1/8] QemuOpts: increase number of vm_config_groups, Gerd Hoffmann, 2015/06/10
- [Qemu-devel] [PULL v3 3/8] fw_cfg: fix FW_CFG_BOOT_DEVICE update on ppc and sparc, Gerd Hoffmann, 2015/06/10
- [Qemu-devel] [PULL v3 7/8] fw_cfg: insert fw_cfg file blobs via qemu cmdline, Gerd Hoffmann, 2015/06/10
- [Qemu-devel] [PULL v3 8/8] bios-tables-test: handle false-positive smbios signature matches, Gerd Hoffmann, 2015/06/10
- Re: [Qemu-devel] [PULL v3 0/8] fw_cfg patch queue, Peter Maydell, 2015/06/10