[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [qemu-upstream-unstable] rng-egd: offset the point when repeatedly read from the buffer



commit 7cfd037403ba34e8ed1ebfa4e7d6abec738e2000
Author:     Amos Kong <akong@xxxxxxxxxx>
AuthorDate: Thu Nov 21 16:42:51 2013 +0800
Commit:     Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
CommitDate: Mon Dec 9 11:40:30 2013 -0600

    rng-egd: offset the point when repeatedly read from the buffer
    
    The buffer content might be read out more than once, currently
    we just repeatedly read the first data block, buffer offset is
    missing.
    
    Cc: qemu-stable@xxxxxxxxxx
    Signed-off-by: Amos Kong <akong@xxxxxxxxxx>
    Message-id: 1385023371-8198-3-git-send-email-akong@xxxxxxxxxx
    Signed-off-by: Anthony Liguori <aliguori@xxxxxxxxxx>
    (cherry picked from commit 1eb1bd9eafa890f1f4d16ef5cb8b9239a86874d9)
    
    Signed-off-by: Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
---
 backends/rng-egd.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

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;
 
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.