On Mon, Nov 26, 2012 at 1:43 PM, Andreas Färber <afaer...@suse.de> wrote: > Am 26.11.2012 13:10, schrieb Stefan Hajnoczi: >> visit_type_size() requires either visitor->type_size() or >> visitor_uint64() to be implemented, otherwise a NULL function pointer is >> invoked. >> >> It is possible to trigger this crash as follows: >> >> $ qemu-system-x86_64 -netdev tap,sndbuf=0,id=netdev0 \ >> -device virtio-blk-pci,netdev=netdev0 >> >> The 'sndbuf' option has type "size". >> >> Signed-off-by: Stefan Hajnoczi <stefa...@redhat.com> >> --- >> This patch ensures that -netdev tap,sndbuf=X works in QEMU 1.3. > > Reviewed-by: Andreas Färber <afaer...@suse.de> > > Did you check whether any other types were unhandled?
The visitors do not handle all types. Only the opts visitor and now the dealloc visitor handle ->type_size(). This will not cause a problem yet because only the netdev options include fields with the 'size' type. That code path is now covered. In the longer term we should clean up the int, number, uint64, size type proliferation and handle them consistently. > Should a comment be added somewhere along the lines of "If you add a > hook here you also need to implement one there" to avoid such > inconsistency for the future? There is no single point like register_visitor() where we could check that callbacks are set up. That would have been a nice way to prevent incomplete visitors. The issue is that qapi/qapi-visit-core.h says type_uint64 and type_size may be NULL, but it documents that visit_type_size() falls back to type_uint64() if type_size() is NULL. The case we hit was that type_uint64() is also NULL. Should it fall back to type_int() (int64_t)? Stefan -- You received this bug notification because you are a member of Ubuntu Server Team, which is subscribed to qemu-kvm in Ubuntu. https://bugs.launchpad.net/bugs/1079713 Title: failed to set sndbuf on VMs network interface To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1079713/+subscriptions -- Ubuntu-server-bugs mailing list Ubuntu-server-bugs@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs