]> xenbits.xensource.com Git - qemu-xen.git/commit
vhost: Distinguish errors in vhost_dev_get_config()
authorKevin Wolf <kwolf@redhat.com>
Wed, 9 Jun 2021 15:46:56 +0000 (08:46 -0700)
committerKevin Wolf <kwolf@redhat.com>
Wed, 30 Jun 2021 11:18:42 +0000 (13:18 +0200)
commit50de51387f3fda9d3da049d60f8b631164f11f08
tree8f5f3737a57ce956a82a8af195b2447c8cf48fcc
parentb8da65689ac18f4d288bdc679fb178031bdd929e
vhost: Distinguish errors in vhost_dev_get_config()

Instead of just returning 0/-1 and letting the caller make up a
meaningless error message, add an Error parameter to allow reporting the
real error and switch to 0/-errno so that different kind of errors can
be distinguished in the caller.

config_len in vhost_user_get_config() is defined by the device, so if
it's larger than VHOST_USER_MAX_CONFIG_SIZE, this is a programming
error. Turn the corresponding check into an assertion.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20210609154658.350308-6-kwolf@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
hw/block/vhost-user-blk.c
hw/display/vhost-user-gpu.c
hw/input/vhost-user-input.c
hw/net/vhost_net.c
hw/virtio/vhost-user-vsock.c
hw/virtio/vhost-user.c
hw/virtio/vhost-vdpa.c
hw/virtio/vhost.c
include/hw/virtio/vhost-backend.h
include/hw/virtio/vhost.h