* [Qemu-devel] [PATCH 1.7 0/2] fix rng-egd backend
@ 2013-11-21 8:42 Amos Kong
2013-11-21 8:42 ` [Qemu-devel] [PATCH 1.7 1/2] rng-egd: remove redundant free Amos Kong
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Amos Kong @ 2013-11-21 8:42 UTC (permalink / raw)
To: qemu-devel; +Cc: amit.shah, anthony
The first is a trivial cleanup, the second patch fixes a memcpy
bug in reading data from chardev to request data buffer.
Amos Kong (2):
rng-egd: remove redundant free
rng-egd: offset the point when repeatedly read from the buffer
backends/rng-egd.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--
1.8.3.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH 1.7 1/2] rng-egd: remove redundant free
2013-11-21 8:42 [Qemu-devel] [PATCH 1.7 0/2] fix rng-egd backend Amos Kong
@ 2013-11-21 8:42 ` Amos Kong
2013-11-21 8:42 ` [Qemu-devel] [PATCH 1.7 2/2] rng-egd: offset the point when repeatedly read from the buffer Amos Kong
2013-11-21 15:26 ` [Qemu-devel] [PATCH 1.7 0/2] fix rng-egd backend Paolo Bonzini
2 siblings, 0 replies; 4+ messages in thread
From: Amos Kong @ 2013-11-21 8:42 UTC (permalink / raw)
To: qemu-devel; +Cc: amit.shah, anthony
We didn't set default chr_name, the free is redundant.
Signed-off-by: Amos Kong <akong@redhat.com>
---
backends/rng-egd.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/backends/rng-egd.c b/backends/rng-egd.c
index 9e5a536..6f56f9e 100644
--- a/backends/rng-egd.c
+++ b/backends/rng-egd.c
@@ -167,7 +167,6 @@ static void rng_egd_set_chardev(Object *obj, const char *value, Error **errp)
if (b->opened) {
error_set(errp, QERR_PERMISSION_DENIED);
} else {
- g_free(s->chr_name);
s->chr_name = g_strdup(value);
}
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH 1.7 2/2] rng-egd: offset the point when repeatedly read from the buffer
2013-11-21 8:42 [Qemu-devel] [PATCH 1.7 0/2] fix rng-egd backend Amos Kong
2013-11-21 8:42 ` [Qemu-devel] [PATCH 1.7 1/2] rng-egd: remove redundant free Amos Kong
@ 2013-11-21 8:42 ` Amos Kong
2013-11-21 15:26 ` [Qemu-devel] [PATCH 1.7 0/2] fix rng-egd backend Paolo Bonzini
2 siblings, 0 replies; 4+ messages in thread
From: Amos Kong @ 2013-11-21 8:42 UTC (permalink / raw)
To: qemu-devel; +Cc: amit.shah, qemu-stable, anthony
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@nongnu.org
Signed-off-by: Amos Kong <akong@redhat.com>
---
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 6f56f9e..25bb3b4 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.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH 1.7 0/2] fix rng-egd backend
2013-11-21 8:42 [Qemu-devel] [PATCH 1.7 0/2] fix rng-egd backend Amos Kong
2013-11-21 8:42 ` [Qemu-devel] [PATCH 1.7 1/2] rng-egd: remove redundant free Amos Kong
2013-11-21 8:42 ` [Qemu-devel] [PATCH 1.7 2/2] rng-egd: offset the point when repeatedly read from the buffer Amos Kong
@ 2013-11-21 15:26 ` Paolo Bonzini
2 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2013-11-21 15:26 UTC (permalink / raw)
To: Amos Kong; +Cc: amit.shah, qemu-devel, anthony
Il 21/11/2013 09:42, Amos Kong ha scritto:
> The first is a trivial cleanup, the second patch fixes a memcpy
> bug in reading data from chardev to request data buffer.
>
> Amos Kong (2):
> rng-egd: remove redundant free
> rng-egd: offset the point when repeatedly read from the buffer
>
> backends/rng-egd.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-11-21 15:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-21 8:42 [Qemu-devel] [PATCH 1.7 0/2] fix rng-egd backend Amos Kong
2013-11-21 8:42 ` [Qemu-devel] [PATCH 1.7 1/2] rng-egd: remove redundant free Amos Kong
2013-11-21 8:42 ` [Qemu-devel] [PATCH 1.7 2/2] rng-egd: offset the point when repeatedly read from the buffer Amos Kong
2013-11-21 15:26 ` [Qemu-devel] [PATCH 1.7 0/2] fix rng-egd backend Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).