[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 32/32] rng-egd: offset the point when repeatedly rea
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH 32/32] rng-egd: offset the point when repeatedly read from the buffer |
Date: |
Wed, 4 Dec 2013 08:34:39 -0600 |
From: Amos Kong <address@hidden>
The buffer content might be read out more than once, currently
we just repeatedly read the first data block, buffer offset is
missing.
Cc: address@hidden
Signed-off-by: Amos Kong <address@hidden>
Message-id: address@hidden
Signed-off-by: Anthony Liguori <address@hidden>
(cherry picked from commit 1eb1bd9eafa890f1f4d16ef5cb8b9239a86874d9)
Signed-off-by: Michael Roth <address@hidden>
---
backends/rng-egd.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/backends/rng-egd.c b/backends/rng-egd.c
index 9e5a536..2962795 100644
--- a/backends/rng-egd.c
+++ b/backends/rng-egd.c
@@ -91,12 +91,14 @@ static int rng_egd_chr_can_read(void *opaque)
static void rng_egd_chr_read(void *opaque, const uint8_t *buf, int size)
{
RngEgd *s = RNG_EGD(opaque);
+ size_t buf_offset = 0;
while (size > 0 && s->requests) {
RngRequest *req = s->requests->data;
int len = MIN(size, req->size - req->offset);
- memcpy(req->data + req->offset, buf, len);
+ memcpy(req->data + req->offset, buf + buf_offset, len);
+ buf_offset += len;
req->offset += len;
size -= len;
--
1.7.9.5
- [Qemu-devel] [PATCH 03/32] char: remove watch callback on chardev detach from frontend, (continued)
- [Qemu-devel] [PATCH 03/32] char: remove watch callback on chardev detach from frontend, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 02/32] char: use common function to disable callbacks on chardev close, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 07/32] bitops: Add rotate functions (rol8, ror8, ...), Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 06/32] tci: Add implementation of rotl_i64, rotr_i64, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 09/32] qemu-char: Fix potential out of bounds access to local arrays, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 10/32] xen_disk: mark ioreq as mapped before unmapping in error case, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 08/32] misc: Use new rotate functions, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 12/32] audio: honor QEMU_AUDIO_TIMER_PERIOD instead of waking up every *nano* second, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 30/32] qdev-monitor: Unref device when device_add fails, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 31/32] pci: unregister vmstate_pcibus on unplug, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 32/32] rng-egd: offset the point when repeatedly read from the buffer,
Michael Roth <=
- [Qemu-devel] [PATCH 29/32] qdev-monitor: Fix crash when device_add is called with abstract driver, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 26/32] vfio-pci: Fix multifunction=on, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 28/32] qom: Fix memory leak in object_property_set_link(), Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 13/32] monitor: eliminate monitor_event_state_lock, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 27/32] virtio-net: fix the memory leak in rxfilter_notify(), Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 21/32] virtio-net: only delete bh that existed, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 24/32] qcow2: count_contiguous_clusters and compression, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 25/32] qcow2: fix possible corruption when reading multiple clusters, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 20/32] linux-user: Fix stat64 syscall for SPARC64, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 14/32] memory: fix 128 arithmetic in info mtree, Michael Roth, 2013/12/04