qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] xbzrle: don't check the value in the vm ram repeatedly
@ 2014-03-29  7:52 arei.gonglei
  2014-03-29 13:53 ` Eric Blake
  0 siblings, 1 reply; 7+ messages in thread
From: arei.gonglei @ 2014-03-29  7:52 UTC (permalink / raw)
  To: qemu-devel
  Cc: ChenLiang, weidong.huang, quintela, dgilbert, owasserm, Gonglei,
	mrhines, pbonzini

From: ChenLiang <chenliang88@huawei.com>

xbzrle_encode_buffer checks the value in the ram repeatedly.
It is risk if runs xbzrle_encode_buffer on changing data.
And it is not necessary.

Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: ChenLiang <chenliang88@huawei.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
---
 xbzrle.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xbzrle.c b/xbzrle.c
index fbcb35d..e2c7595 100644
--- a/xbzrle.c
+++ b/xbzrle.c
@@ -82,6 +82,8 @@ int xbzrle_encode_buffer(uint8_t *old_buf, uint8_t *new_buf, int slen,
         if (d + 2 > dlen) {
             return -1;
         }
+        i++;
+        nzrun_len++;
         /* not aligned to sizeof(long) */
         res = (slen - i) % sizeof(long);
         while (res && old_buf[i] != new_buf[i]) {
@@ -118,6 +120,8 @@ int xbzrle_encode_buffer(uint8_t *old_buf, uint8_t *new_buf, int slen,
         memcpy(dst + d, nzrun_start, nzrun_len);
         d += nzrun_len;
         nzrun_len = 0;
+        i++;
+        zrun_len++;
     }
 
     return d;
-- 
1.7.12.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-03-31  9:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-29  7:52 [Qemu-devel] [PATCH] xbzrle: don't check the value in the vm ram repeatedly arei.gonglei
2014-03-29 13:53 ` Eric Blake
2014-03-29 14:15   ` 陈梁
2014-03-29 14:26     ` Eric Blake
     [not found]       ` <C734EB68-7CC7-4028-BD08-0FC54819FD21@icloud.com>
     [not found]         ` <F822EA2B-2483-446F-A92C-662B381D1B81@icloud.com>
2014-03-29 15:33           ` Eric Blake
     [not found]         ` <F5241465-1514-4695-8EE0-F781549403FF@icloud.com>
2014-03-29 15:38           ` Eric Blake
2014-03-31  9:40     ` Dr. David Alan Gilbert

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).