bdev/virtio: Abort on bad index in virtio_dev_queue_get_thread
There is no way to recover from this. Change-Id: I1667b032bab867d58ad23fa8b1bd59f81620b442 Signed-off-by: Ben Walker <benjamin.walker@intel.com> Reviewed-on: https://review.gerrithub.io/408246 Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
parent
7540c61a21
commit
a00b6819a1
@ -613,20 +613,16 @@ virtio_dev_find_and_acquire_queue(struct virtio_dev *vdev, uint16_t start_index)
|
||||
struct spdk_thread *
|
||||
virtio_dev_queue_get_thread(struct virtio_dev *vdev, uint16_t index)
|
||||
{
|
||||
struct virtqueue *vq;
|
||||
struct spdk_thread *thread = NULL;
|
||||
|
||||
if (index >= vdev->max_queues) {
|
||||
SPDK_ERRLOG("given vq index %"PRIu16" exceeds max queue count %"PRIu16"\n",
|
||||
index, vdev->max_queues);
|
||||
return NULL;
|
||||
abort(); /* This is not recoverable */
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&vdev->mutex);
|
||||
vq = vdev->vqs[index];
|
||||
if (vq != NULL) {
|
||||
thread = vq->owner_thread;
|
||||
}
|
||||
thread = vdev->vqs[index]->owner_thread;
|
||||
pthread_mutex_unlock(&vdev->mutex);
|
||||
|
||||
return thread;
|
||||
|
Loading…
Reference in New Issue
Block a user