lkml.org 
[lkml]   [2022]   [Mar]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 1/3] vdpa: support exposing the config size to userspace
On Tue, Mar 15, 2022 at 11:25:51AM +0800, Longpeng(Mike) wrote:
>From: Longpeng <longpeng2@huawei.com>
>
>- 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@redhat.com>
>Signed-off-by: Longpeng <longpeng2@huawei.com>
>---
> 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@redhat.com>

\
 
 \ /
  Last update: 2022-03-15 10:38    [W:0.106 / U:0.252 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site