thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-rng-egd-offset-the-point-when-repeatedly-read-from-t.patch

9ae3a8
From 5b3829247a3edf89ebc63e8c2be2554fd66dfd41 Mon Sep 17 00:00:00 2001
9ae3a8
From: Amos Kong <akong@redhat.com>
9ae3a8
Date: Sat, 23 Nov 2013 03:48:48 +0100
9ae3a8
Subject: [PATCH 13/14] rng-egd: offset the point when repeatedly read from the buffer
9ae3a8
9ae3a8
RH-Author: Amos Kong <akong@redhat.com>
9ae3a8
Message-id: <1385178528-7953-1-git-send-email-akong@redhat.com>
9ae3a8
Patchwork-id: 55868
9ae3a8
O-Subject: [RHEL-7.0 qemu-kvm PATCH] rng-egd: offset the point when repeatedly read from the buffer
9ae3a8
Bugzilla: 1032862
9ae3a8
RH-Acked-by: Fam Zheng <famz@redhat.com>
9ae3a8
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
RH-Acked-by: Vlad Yasevich <vyasevic@redhat.com>
9ae3a8
RH-Acked-by: Amit Shah <amit.shah@redhat.com>
9ae3a8
RH-Acked-by: Xiao Wang <jasowang@redhat.com>
9ae3a8
9ae3a8
Bugzilla: 1032862
9ae3a8
Brew: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=6634396
9ae3a8
9ae3a8
The buffer content might be read out more than once, currently
9ae3a8
we just repeatedly read the first data block, buffer offset is
9ae3a8
missing.
9ae3a8
9ae3a8
Cc: qemu-stable@nongnu.org
9ae3a8
Signed-off-by: Amos Kong <akong@redhat.com>
9ae3a8
Message-id: 1385023371-8198-3-git-send-email-akong@redhat.com
9ae3a8
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
9ae3a8
(cherry picked from commit 1eb1bd9eafa890f1f4d16ef5cb8b9239a86874d9)
9ae3a8
---
9ae3a8
 backends/rng-egd.c |    4 +++-
9ae3a8
 1 files changed, 3 insertions(+), 1 deletions(-)
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 backends/rng-egd.c |    4 +++-
9ae3a8
 1 files changed, 3 insertions(+), 1 deletions(-)
9ae3a8
9ae3a8
diff --git a/backends/rng-egd.c b/backends/rng-egd.c
9ae3a8
index 9e5a536..2962795 100644
9ae3a8
--- a/backends/rng-egd.c
9ae3a8
+++ b/backends/rng-egd.c
9ae3a8
@@ -91,12 +91,14 @@ static int rng_egd_chr_can_read(void *opaque)
9ae3a8
 static void rng_egd_chr_read(void *opaque, const uint8_t *buf, int size)
9ae3a8
 {
9ae3a8
     RngEgd *s = RNG_EGD(opaque);
9ae3a8
+    size_t buf_offset = 0;
9ae3a8
 
9ae3a8
     while (size > 0 && s->requests) {
9ae3a8
         RngRequest *req = s->requests->data;
9ae3a8
         int len = MIN(size, req->size - req->offset);
9ae3a8
 
9ae3a8
-        memcpy(req->data + req->offset, buf, len);
9ae3a8
+        memcpy(req->data + req->offset, buf + buf_offset, len);
9ae3a8
+        buf_offset += len;
9ae3a8
         req->offset += len;
9ae3a8
         size -= len;
9ae3a8
 
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8