lkml.org 
[lkml]   [2012]   [Dec]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFCv2 11/11] remoteproc: Support virtio config space.
Hi Sjur,

On Fri, Dec 14, 2012 at 05:07:00PM +0100, Sjur Brændeland wrote:
> Support virtio configuration space and device status and
> feature negotiation with remote device. This virtio device
> can now access the resource table in shared memory.
>
> Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
> ---

...

> +void rproc_virtio_get(struct virtio_device *vdev, unsigned offset,
> + void *buf, unsigned len)
> +{
> + struct rproc_vdev *rvdev = vdev_to_rvdev(vdev);
> + void *cfg = &rvdev->rsc->vring[rvdev->rsc->num_of_vrings];
> + memcpy(buf, cfg + offset, len);
> +}
> +
> +void rproc_virtio_set(struct virtio_device *vdev, unsigned offset,
> + const void *buf, unsigned len)
> +{
> + struct rproc_vdev *rvdev = vdev_to_rvdev(vdev);
> + void *cfg = &rvdev->rsc->vring[rvdev->rsc->num_of_vrings];
> + memcpy(cfg + offset, buf, len);
> }

Perhaps verify the offset and length to avoid overwriting memory?

Thanks,
Ido.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2012-12-21 04:01    [W:0.203 / U:0.980 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site