On Tue, Mar 15, 2022 at 11:25:51AM +0800, Longpeng(Mike) wrote:
From: Longpeng <longpeng2@xxxxxxxxxx> - GET_CONFIG_SIZE: return the size of the virtio config space. The size contains the fields which are conditional on feature bits. Acked-by: Jason Wang <jasowang@xxxxxxxxxx> Signed-off-by: Longpeng <longpeng2@xxxxxxxxxx> --- drivers/vhost/vdpa.c | 17 +++++++++++++++++ include/linux/vdpa.h | 3 ++- include/uapi/linux/vhost.h | 4 ++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index ec5249e..605c7ae 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -355,6 +355,20 @@ static long vhost_vdpa_get_iova_range(struct vhost_vdpa *v, u32 __user *argp) return 0; } +static long vhost_vdpa_get_config_size(struct vhost_vdpa *v, u32 __user *argp) +{ + struct vdpa_device *vdpa = v->vdpa; + const struct vdpa_config_ops *ops = vdpa->config; + u32 size; + + size = ops->get_config_size(vdpa);
get_config_size() returns a size_t, perhaps we could have a comment here where we say we don't expect there to be an overflow.
I don't have a strong opinion on this, and I wouldn't want to get you to repin just for that, so:
Reviewed-by: Stefano Garzarella <sgarzare@xxxxxxxxxx> _______________________________________________ Virtualization mailing list Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linuxfoundation.org/mailman/listinfo/virtualization