aboutsummaryrefslogtreecommitdiff
path: root/softmmu
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@redhat.com>2020-05-19 19:17:09 +0200
committerPhilippe Mathieu-Daudé <philmd@redhat.com>2020-07-03 18:16:01 +0200
commitf7d8afb16dceb780270960692b949329c8752ff2 (patch)
treea1e0e54f0891bfb3c0dc99b136020d555035c80a /softmmu
parent6552d87c48679e1ece2da3ddc0947d2146de53ee (diff)
softmmu/vl: Allow -fw_cfg 'gen_id' option to use the 'etc/' namespace
Names of user-provided fw_cfg items are supposed to start with "opt/". However FW_CFG_DATA_GENERATOR items are generated by QEMU, so allow the "etc/" namespace in this specific case. Reviewed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20200623172726.21040-5-philmd@redhat.com>
Diffstat (limited to 'softmmu')
-rw-r--r--softmmu/vl.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 13cada39d6..159f0352a9 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -2049,7 +2049,13 @@ static int parse_fw_cfg(void *opaque, QemuOpts *opts, Error **errp)
FW_CFG_MAX_FILE_PATH - 1);
return -1;
}
- if (strncmp(name, "opt/", 4) != 0) {
+ if (nonempty_str(gen_id)) {
+ /*
+ * In this particular case where the content is populated
+ * internally, the "etc/" namespace protection is relaxed,
+ * so do not emit a warning.
+ */
+ } else if (strncmp(name, "opt/", 4) != 0) {
warn_report("externally provided fw_cfg item names "
"should be prefixed with \"opt/\"");
}