cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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