From patchwork Tue Nov 19 05:53:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wangting (Kathy)" X-Patchwork-Id: 292317 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 9BC062C00A4 for ; Tue, 19 Nov 2013 19:01:54 +1100 (EST) Received: from localhost ([::1]:47669 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VigFr-0006E0-AA for incoming@patchwork.ozlabs.org; Tue, 19 Nov 2013 03:01:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45784) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VieGM-0000Pi-0d for qemu-devel@nongnu.org; Tue, 19 Nov 2013 00:54:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VieGE-0006pV-Df for qemu-devel@nongnu.org; Tue, 19 Nov 2013 00:54:13 -0500 Received: from szxga01-in.huawei.com ([119.145.14.64]:11454) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VieGD-0006ZY-GM for qemu-devel@nongnu.org; Tue, 19 Nov 2013 00:54:06 -0500 Received: from 172.24.2.119 (EHLO szxeml207-edg.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id BMY12786; Tue, 19 Nov 2013 13:53:57 +0800 (CST) Received: from SZXEML413-HUB.china.huawei.com (10.82.67.152) by szxeml207-edg.china.huawei.com (172.24.2.56) with Microsoft SMTP Server (TLS) id 14.3.158.1; Tue, 19 Nov 2013 13:53:54 +0800 Received: from SZXEMA402-HUB.china.huawei.com (10.82.72.34) by szxeml413-hub.china.huawei.com (10.82.67.152) with Microsoft SMTP Server (TLS) id 14.3.158.1; Tue, 19 Nov 2013 13:53:56 +0800 Received: from SZXEMA505-MBX.china.huawei.com ([169.254.1.174]) by SZXEMA402-HUB.china.huawei.com ([10.82.72.34]) with mapi id 14.03.0158.001; Tue, 19 Nov 2013 13:53:46 +0800 From: "Wangting (Kathy)" To: "qemu-devel@nongnu.org" , "pbonzini@redhat.com" Thread-Topic: [PATCH] the calculation of bytes_xfer in qemu_put_buffer() is wrong Thread-Index: AQHO5Ou16BBryvX200+vdoB+dtxx/w== Date: Tue, 19 Nov 2013 05:53:45 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.135.68.236] MIME-Version: 1.0 X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 119.145.14.64 X-Mailman-Approved-At: Tue, 19 Nov 2013 03:01:30 -0500 Cc: "zhangmin \(S\)" , Luonengjun , Qinling , "Chentao \(Boby\)" , "Wangrui \(K\)" , "Wubin \(H\)" Subject: [Qemu-devel] [PATCH] the calculation of bytes_xfer in qemu_put_buffer() is wrong X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org In qemu_put_buffer(), bytes_xfer += size is wrong, it will be more than expected, and should be bytes_xfer += l. Signed-off-by: zhangmin > Reviewed-by: Paolo Bonzini --- savevm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) -- 1.7.3.1.msysgit.0 diff --git a/savevm.c b/savevm.c index 2f631d4..3f912dd 100644 --- a/savevm.c +++ b/savevm.c @@ -794,7 +794,7 @@ void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, int size) if (l > size) l = size; memcpy(f->buf + f->buf_index, buf, l); - f->bytes_xfer += size; + f->bytes_xfer += l; if (f->ops->writev_buffer) { add_to_iovec(f, f->buf + f->buf_index, l); }