2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-16 17:23:55 +08:00

virtio_config: fix virtio_cread_bytes

virtio_cread_bytes is implemented incorrectly in case length happens to
be 2,4 or 8 bytes: transports and devices will assume it's an integer
value that has to be converted to LE format.

Let's just do multiple 1-byte reads: this also makes life easier
for transports who only need to implement 1,2,4 and 8 byte reads.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Michael S. Tsirkin 2014-12-11 15:54:07 +02:00
parent 30683a8cce
commit 3d2667826c

View File

@ -305,7 +305,10 @@ static inline void virtio_cread_bytes(struct virtio_device *vdev,
unsigned int offset,
void *buf, size_t len)
{
vdev->config->get(vdev, offset, buf, len);
int i;
for (i = 0; i < len; i++)
vdev->config->get(vdev, offset + i, buf + i, 1);
}
static inline void virtio_cwrite8(struct virtio_device *vdev,