qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

qapi: Assert non-input visitors see only valid alternate tags

An alternate type's visit_type_FOO() fails when it runs into an
invalid ->type.

This is appropriate with an input visitor: visit_start_alternate()
sets ->type according to the input, and bad input can lead to bad
->type.

It should never happen with an output, clone or dealloc visitor: if it
did, the alternate being output, cloned or deallocated would be messed
up beyond repair. Assert that.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200424084338.26803-12-armbru@redhat.com>

+1
+1
scripts/qapi/visit.py
··· 232 232 case QTYPE_NONE: 233 233 abort(); 234 234 default: 235 + assert(visit_is_input(v)); 235 236 error_setg(&err, QERR_INVALID_PARAMETER_TYPE, name ? name : "null", 236 237 "%(name)s"); 237 238 /* Avoid passing invalid *obj to qapi_free_%(c_name)s() */