From: Stefano Garzarella <sgarz...@redhat.com> commit fde5b51795fa87107c13092eb54f6632b3b2f70b from https://github.com/altera-opensource/linux-socfpga.git
[upstream commit d6d8bb92fdde6390037bf9da174ed3ab551c04d7] Let's use the new 'get_config_size()' callback available instead of using the 'virtio_id' to get the size of the device config space. Signed-off-by: Stefano Garzarella <sgarz...@redhat.com> Link: https://lore.kernel.org/r/20210315163450.254396-10-sgarz...@redhat.com Signed-off-by: Michael S. Tsirkin <m...@redhat.com> Acked-by: Jason Wang <jasow...@redhat.com> Signed-off-by: Wenlin Kang <wenlin.k...@windriver.com> --- drivers/vhost/vdpa.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index 04578aa87e4d..b2d4b1139ab5 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -191,13 +191,8 @@ static long vhost_vdpa_set_status(struct vhost_vdpa *v, u8 __user *statusp) static int vhost_vdpa_config_validate(struct vhost_vdpa *v, struct vhost_vdpa_config *c) { - long size = 0; - - switch (v->virtio_id) { - case VIRTIO_ID_NET: - size = sizeof(struct virtio_net_config); - break; - } + struct vdpa_device *vdpa = v->vdpa; + long size = vdpa->config->get_config_size(vdpa); if (c->len == 0 || c->off > size) return -EINVAL; -- 2.25.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12580): https://lists.yoctoproject.org/g/linux-yocto/message/12580 Mute This Topic: https://lists.yoctoproject.org/mt/98921501/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-