From: "Gabriel L. Somlo" <somlo@cmu.edu>
To: qemu-devel@nongnu.org
Cc: gsomlo@gmail.com, matt.fleming@intel.com, lersek@redhat.com,
kraxel@redhat.com, mst@redhat.com
Subject: [Qemu-devel] [PATCH V4 3/4] fw_cfg: prohibit insertion of duplicate fw_cfg file names
Date: Wed, 29 Apr 2015 11:21:52 -0400 [thread overview]
Message-ID: <1430320913-20737-4-git-send-email-somlo@cmu.edu> (raw)
In-Reply-To: <1430320913-20737-1-git-send-email-somlo@cmu.edu>
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 <somlo@cmu.edu>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
---
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 227beaf..8d4ea25 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -505,18 +505,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 1275b70..a340c5a 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
--
2.1.0
next prev parent reply other threads:[~2015-04-29 15:22 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-29 15:21 [Qemu-devel] [PATCH V4 0/4] fw-cfg: cleanup and user-provided command line blobs Gabriel L. Somlo
2015-04-29 15:21 ` [Qemu-devel] [PATCH V4 1/4] fw_cfg: remove support for guest-side data writes Gabriel L. Somlo
2015-04-29 15:21 ` [Qemu-devel] [PATCH V4 2/4] fw_cfg: prevent selector key conflict Gabriel L. Somlo
2015-04-29 15:21 ` Gabriel L. Somlo [this message]
2015-04-29 15:21 ` [Qemu-devel] [PATCH V4 4/4] fw_cfg: insert fw_cfg file blobs via qemu cmdline Gabriel L. Somlo
2015-05-31 18:10 ` Michael S. Tsirkin
2015-06-01 7:06 ` Laszlo Ersek
2015-06-01 7:28 ` Michael S. Tsirkin
2015-06-01 9:01 ` Paolo Bonzini
2015-06-01 10:23 ` Michael S. Tsirkin
2015-06-01 10:35 ` Laszlo Ersek
2015-06-01 10:42 ` Michael S. Tsirkin
2015-06-01 11:19 ` Laszlo Ersek
2015-06-01 10:43 ` Paolo Bonzini
2015-06-01 10:48 ` Michael S. Tsirkin
2015-06-01 10:50 ` Paolo Bonzini
2015-06-01 11:00 ` Michael S. Tsirkin
2015-06-01 11:18 ` Paolo Bonzini
2015-06-01 11:05 ` Gabriel L. Somlo
2015-06-01 11:20 ` Markus Armbruster
2015-06-01 11:21 ` Paolo Bonzini
2015-06-01 11:26 ` Laszlo Ersek
2015-06-01 12:38 ` Michael S. Tsirkin
2015-06-01 12:39 ` Paolo Bonzini
2015-06-01 12:41 ` Michael S. Tsirkin
2015-06-01 12:43 ` Paolo Bonzini
2015-06-02 7:37 ` Gerd Hoffmann
2015-06-02 8:28 ` Michael S. Tsirkin
2015-06-02 9:43 ` Gerd Hoffmann
2015-06-01 13:21 ` Laszlo Ersek
2015-06-01 11:24 ` Laszlo Ersek
2015-05-18 13:05 ` [Qemu-devel] [PATCH V4 0/4] fw-cfg: cleanup and user-provided command line blobs Gabriel L. Somlo
2015-05-29 12:41 ` Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1430320913-20737-4-git-send-email-somlo@cmu.edu \
--to=somlo@cmu.edu \
--cc=gsomlo@gmail.com \
--cc=kraxel@redhat.com \
--cc=lersek@redhat.com \
--cc=matt.fleming@intel.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).