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>
Showing
- hw/block/vhost-user-blk.c 5 additions, 4 deletionshw/block/vhost-user-blk.c
- hw/display/vhost-user-gpu.c 4 additions, 2 deletionshw/display/vhost-user-gpu.c
- hw/input/vhost-user-input.c 4 additions, 2 deletionshw/input/vhost-user-input.c
- hw/net/vhost_net.c 1 addition, 1 deletionhw/net/vhost_net.c
- hw/virtio/vhost-user-vsock.c 5 additions, 4 deletionshw/virtio/vhost-user-vsock.c
- hw/virtio/vhost-user.c 12 additions, 12 deletionshw/virtio/vhost-user.c
- hw/virtio/vhost-vdpa.c 1 addition, 1 deletionhw/virtio/vhost-vdpa.c
- hw/virtio/vhost.c 11 additions, 3 deletionshw/virtio/vhost.c
- include/hw/virtio/vhost-backend.h 1 addition, 1 deletioninclude/hw/virtio/vhost-backend.h
- include/hw/virtio/vhost.h 2 additions, 2 deletionsinclude/hw/virtio/vhost.h
Loading
Please register or sign in to comment