Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <angus.chen@jaguarmicro.com>
Message-Id: <20221101111655.1947-1-angus.chen@jaguarmicro.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

authored by

Angus Chen and committed by
Michael S. Tsirkin
b66ead2d a9f0a19f

+1 -1
+1 -1
drivers/virtio/virtio_pci_modern.c
··· 303 303 int err; 304 304 305 305 if (index >= vp_modern_get_num_queues(mdev)) 306 - return ERR_PTR(-ENOENT); 306 + return ERR_PTR(-EINVAL); 307 307 308 308 /* Check if queue is either not available or already active. */ 309 309 num = vp_modern_get_queue_size(mdev, index);