Skip to content

Commit b66ead2

Browse files
Angus Chenmstsirkin
authored andcommitted
virtio_pci: modify ENOENT to EINVAL
Virtio_crypto use max_data_queues+1 to setup vqs, we use vp_modern_get_num_queues to protect the vq range in setup_vq. We could enter index >= vp_modern_get_num_queues(mdev) in setup_vq if common->num_queues is not set well,and it return -ENOENT. It is better to use -EINVAL instead. Signed-off-by: Angus Chen <[email protected]> Message-Id: <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent a9f0a19 commit b66ead2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/virtio/virtio_pci_modern.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ static struct virtqueue *setup_vq(struct virtio_pci_device *vp_dev,
303303
int err;
304304

305305
if (index >= vp_modern_get_num_queues(mdev))
306-
return ERR_PTR(-ENOENT);
306+
return ERR_PTR(-EINVAL);
307307

308308
/* Check if queue is either not available or already active. */
309309
num = vp_modern_get_queue_size(mdev, index);

0 commit comments

Comments
 (0)