Displaying 7 results from an estimated 7 matches for "max_dma_size".
2023 May 10
3
[PATCH] virtio_ring: use u32 for virtio_max_dma_size
Both split ring and packed ring use 32bits to describe the length of
a descriptor: see struct vring_desc and struct vring_packed_desc.
This means the max segment size supported by virtio is U32_MAX.
An example of virtio_max_dma_size in virtio_blk.c:
u32 v, max_size;
max_size = virtio_max_dma_size(vdev); -> implicit convert
err = virtio_cread_feature(vdev, VIRTIO_BLK_F_SIZE_MAX,
struct virtio_blk_config, size_max, &v);
max_size = min(max_size, v);
There is a risk during implicit co...
2023 May 10
2
[PATCH] virtio_ring: use u32 for virtio_max_dma_size
..., zhenwei pi <pizhenwei at bytedance.com> wrote:
> Both split ring and packed ring use 32bits to describe the length of
> a descriptor: see struct vring_desc and struct vring_packed_desc.
> This means the max segment size supported by virtio is U32_MAX.
>
> An example of virtio_max_dma_size in virtio_blk.c:
> u32 v, max_size;
>
> max_size = virtio_max_dma_size(vdev); -> implicit convert
> err = virtio_cread_feature(vdev, VIRTIO_BLK_F_SIZE_MAX,
> struct virtio_blk_config, size_max, &v);
> max_size = min(max_size, v);
>
&...
2023 May 10
1
[PATCH] virtio_ring: use u32 for virtio_max_dma_size
..., May 10, 2023 at 10:54:37AM +0800, zhenwei pi wrote:
> Both split ring and packed ring use 32bits to describe the length of
> a descriptor: see struct vring_desc and struct vring_packed_desc.
> This means the max segment size supported by virtio is U32_MAX.
>
> An example of virtio_max_dma_size in virtio_blk.c:
> u32 v, max_size;
>
> max_size = virtio_max_dma_size(vdev); -> implicit convert
> err = virtio_cread_feature(vdev, VIRTIO_BLK_F_SIZE_MAX,
> struct virtio_blk_config, size_max, &v);
> max_size = min(max_size, v);
>...
2023 Jul 04
1
[PATCH] virtio_ring: use u32 for virtio_max_dma_size
..., May 10, 2023 at 10:54:37AM +0800, zhenwei pi wrote:
> Both split ring and packed ring use 32bits to describe the length of
> a descriptor: see struct vring_desc and struct vring_packed_desc.
> This means the max segment size supported by virtio is U32_MAX.
>
> An example of virtio_max_dma_size in virtio_blk.c:
> u32 v, max_size;
>
> max_size = virtio_max_dma_size(vdev); -> implicit convert
> err = virtio_cread_feature(vdev, VIRTIO_BLK_F_SIZE_MAX,
> struct virtio_blk_config, size_max, &v);
> max_size = min(max_size, v);
>...
2023 May 10
1
[PATCH] virtio_ring: use u32 for virtio_max_dma_size
...i at bytedance.com> wrote:
> > Both split ring and packed ring use 32bits to describe the length of
> > a descriptor: see struct vring_desc and struct vring_packed_desc.
> > This means the max segment size supported by virtio is U32_MAX.
> >
> > An example of virtio_max_dma_size in virtio_blk.c:
> > u32 v, max_size;
> >
> > max_size = virtio_max_dma_size(vdev); -> implicit convert
> > err = virtio_cread_feature(vdev, VIRTIO_BLK_F_SIZE_MAX,
> > struct virtio_blk_config, size_max, &v);
> > max_s...
2023 May 10
1
[PATCH] virtio_ring: use u32 for virtio_max_dma_size
...ote:
> > > Both split ring and packed ring use 32bits to describe the length of
> > > a descriptor: see struct vring_desc and struct vring_packed_desc.
> > > This means the max segment size supported by virtio is U32_MAX.
> > >
> > > An example of virtio_max_dma_size in virtio_blk.c:
> > > u32 v, max_size;
> > >
> > > max_size = virtio_max_dma_size(vdev); -> implicit convert
> > > err = virtio_cread_feature(vdev, VIRTIO_BLK_F_SIZE_MAX,
> > > struct virtio_blk_config, size_max, &...
2023 Sep 04
1
[PATCH] virtio-blk: fix implicit overflow on virtio_max_dma_size
The following codes have an implicit conversion from size_t to u32:
(u32)max_size = (size_t)virtio_max_dma_size(vdev);
This may lead overflow, Ex (size_t)4G -> (u32)0. Once
virtio_max_dma_size() has a larger size than U32_MAX, use U32_MAX
instead.
Signed-off-by: zhenwei pi <pizhenwei at bytedance.com>
---
drivers/block/virtio_blk.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --...