lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d3bc9f2f-52c2-b770-40ff-76a31209c967@redhat.com>
Date:   Mon, 7 Dec 2020 13:30:05 +0800
From:   Jason Wang <jasowang@...hat.com>
To:     Stefano Garzarella <sgarzare@...hat.com>,
        virtualization@...ts.linux-foundation.org
Cc:     Stefan Hajnoczi <stefanha@...hat.com>,
        "Michael S. Tsirkin" <mst@...hat.com>, Oren Duer <oren@...dia.com>,
        Laurent Vivier <lvivier@...hat.com>,
        linux-kernel@...r.kernel.org, Max Gurtovoy <mgurtovoy@...dia.com>,
        Shahaf Shuler <shahafs@...dia.com>, Eli Cohen <elic@...dia.com>
Subject: Re: [PATCH v3 14/19] vdpa_sim: add set_config callback in
 vdpasim_dev_attr


On 2020/12/4 上午1:05, Stefano Garzarella wrote:
> The set_config callback can be used by the device to parse the
> config structure modified by the driver.
>
> The callback will be invoked, if set, in vdpasim_set_config() after
> copying bytes from caller buffer into vdpasim->config buffer.
>
> Signed-off-by: Stefano Garzarella <sgarzare@...hat.com>


Acked-by: Jason Wang <jasowang@...hat.com>


> ---
>   drivers/vdpa/vdpa_sim/vdpa_sim.c | 11 ++++++++++-
>   1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c
> index f935ade0806b..03a8717f80ea 100644
> --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c
> +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c
> @@ -70,6 +70,7 @@ struct vdpasim_dev_attr {
>   
>   	work_func_t work_fn;
>   	void (*get_config)(struct vdpasim *vdpasim, void *config);
> +	void (*set_config)(struct vdpasim *vdpasim, const void *config);
>   };
>   
>   /* State of each vdpasim device */
> @@ -598,7 +599,15 @@ static void vdpasim_get_config(struct vdpa_device *vdpa, unsigned int offset,
>   static void vdpasim_set_config(struct vdpa_device *vdpa, unsigned int offset,
>   			     const void *buf, unsigned int len)
>   {
> -	/* No writable config supportted by vdpasim */
> +	struct vdpasim *vdpasim = vdpa_to_sim(vdpa);
> +
> +	if (offset + len > vdpasim->dev_attr.config_size)
> +		return;
> +
> +	memcpy(vdpasim->config + offset, buf, len);
> +
> +	if (vdpasim->dev_attr.set_config)
> +		vdpasim->dev_attr.set_config(vdpasim, vdpasim->config);
>   }
>   
>   static u32 vdpasim_get_generation(struct vdpa_device *vdpa)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ