From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 15/26] qom: Make object_property_set_qobject()'s input visitor strict
Date: Tue, 28 Feb 2017 20:06:25 +0100 [thread overview]
Message-ID: <1488308796-28832-16-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1488308796-28832-1-git-send-email-armbru@redhat.com>
Commit 240f64b made all qobject input visitors created outside tests
strict, except for the one in object_property_set_qobject(). That one
was left behind only because Eric couldn't spare the time to figure
out whether making it strict would break anything, with a TODO
comment. Time to resolve it.
Strict makes a difference only for otherwise successful visits of QAPI
structs or unions. Let's examine what the callers of
object_property_set_qobject() visit:
* object_property_set_str(), object_property_set_bool(),
object_property_set_int() visit a QString, QBool, QInt,
respectively. Strictness can't matter.
* qmp_qom_set visits its @value argument. Comes straight from QMP and
can be anything ('any' in the QAPI schema). Strictness matters when
the property's set() method visits a struct or union QAPI type.
No such methods exist, thus switching to strict can't break
anything.
If we acquire such methods in the future, we'll *want* the visitor
to be strict, so that unexpected members get rejected as they should
be.
Switch to strict.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <1488303560-18803-16-git-send-email-armbru@redhat.com>
---
qom/qom-qobject.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/qom/qom-qobject.c b/qom/qom-qobject.c
index 447e4a0..bbdedda 100644
--- a/qom/qom-qobject.c
+++ b/qom/qom-qobject.c
@@ -22,8 +22,8 @@ void object_property_set_qobject(Object *obj, QObject *value,
const char *name, Error **errp)
{
Visitor *v;
- /* TODO: Should we reject, rather than ignore, excess input? */
- v = qobject_input_visitor_new(value, false);
+
+ v = qobject_input_visitor_new(value, true);
object_property_set(obj, v, name, errp);
visit_free(v);
}
--
2.7.4
next prev parent reply other threads:[~2017-02-28 19:06 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-28 19:06 [Qemu-devel] [PULL 00/26] QAPI patches for 2017-02-28 Markus Armbruster
2017-02-28 19:06 ` [Qemu-devel] [PULL 01/26] qga: Fix crash on non-dictionary QMP argument Markus Armbruster
2017-02-28 19:06 ` [Qemu-devel] [PULL 02/26] libqtest: Work around a "QMP wants a newline" bug Markus Armbruster
2017-02-28 19:06 ` [Qemu-devel] [PULL 03/26] qmp-test: New, covering basic QMP protocol Markus Armbruster
2017-02-28 19:06 ` [Qemu-devel] [PULL 04/26] qmp: Dumb down how we run QMP command registration Markus Armbruster
2017-02-28 19:06 ` [Qemu-devel] [PULL 05/26] qmp: Clean up how we enforce capability negotiation Markus Armbruster
2017-02-28 19:06 ` [Qemu-devel] [PULL 06/26] qmp: Drop duplicated QMP command object checks Markus Armbruster
2017-02-28 19:06 ` [Qemu-devel] [PULL 07/26] qmp: Eliminate silly QERR_QMP_* macros Markus Armbruster
2017-02-28 19:06 ` [Qemu-devel] [PULL 08/26] qmp: Improve QMP dispatch error messages Markus Armbruster
2017-02-28 19:06 ` [Qemu-devel] [PULL 09/26] qapi: Improve a QObject input visitor error message Markus Armbruster
2017-02-28 19:06 ` [Qemu-devel] [PULL 10/26] qapi: Clean up after commit 3d344c2 Markus Armbruster
2017-02-28 19:06 ` [Qemu-devel] [PULL 11/26] qapi: Make QObject input visitor set *list reliably Markus Armbruster
2017-02-28 19:06 ` [Qemu-devel] [PULL 12/26] qapi: Improve qobject input visitor error reporting Markus Armbruster
2017-02-28 19:06 ` [Qemu-devel] [PULL 13/26] qapi: Drop string input visitor method optional() Markus Armbruster
2017-02-28 19:06 ` [Qemu-devel] [PULL 14/26] qapi: Make string input and opts visitor require non-null input Markus Armbruster
2017-02-28 19:06 ` Markus Armbruster [this message]
2017-02-28 19:06 ` [Qemu-devel] [PULL 16/26] test-qobject-input-visitor: Use strict visitor Markus Armbruster
2017-02-28 19:06 ` [Qemu-devel] [PULL 17/26] qapi: Drop unused non-strict qobject input visitor Markus Armbruster
2017-02-28 19:06 ` [Qemu-devel] [PULL 18/26] tests-qobject-input-strict: Merge into test-qobject-input-visitor Markus Armbruster
2017-02-28 19:06 ` [Qemu-devel] [PULL 19/26] test-string-input-visitor: Tear down existing test automatically Markus Armbruster
2017-02-28 19:06 ` [Qemu-devel] [PULL 20/26] test-string-input-visitor: Improve list coverage Markus Armbruster
2017-02-28 19:06 ` [Qemu-devel] [PULL 21/26] tests: Cover partial input visit of list Markus Armbruster
2017-02-28 19:06 ` [Qemu-devel] [PULL 22/26] test-qobject-input-visitor: Cover missing nested struct member Markus Armbruster
2017-02-28 19:06 ` [Qemu-devel] [PULL 23/26] qapi: Make input visitors detect unvisited list tails Markus Armbruster
2017-02-28 19:06 ` [Qemu-devel] [PULL 24/26] tests: Cover input visit beyond end of list Markus Armbruster
2017-02-28 19:06 ` [Qemu-devel] [PULL 25/26] qapi: Fix object " Markus Armbruster
2017-02-28 19:06 ` [Qemu-devel] [PULL 26/26] qapi: Improve qobject visitor documentation Markus Armbruster
2017-02-28 20:24 ` [Qemu-devel] [PULL 00/26] QAPI patches for 2017-02-28 no-reply
2017-03-01 20:33 ` Peter Maydell
2017-03-03 12:31 ` Markus Armbruster
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=1488308796-28832-16-git-send-email-armbru@redhat.com \
--to=armbru@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).