From patchwork Wed Aug 24 13:42:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dr. David Alan Gilbert" X-Patchwork-Id: 9297845 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A7B9B608A7 for ; Wed, 24 Aug 2016 13:43:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 98BED28FDE for ; Wed, 24 Aug 2016 13:43:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D9AA28FE3; Wed, 24 Aug 2016 13:43:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.9 required=2.0 tests=BAYES_00,HK_NAME_DR, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 46EB128FDE for ; Wed, 24 Aug 2016 13:43:13 +0000 (UTC) Received: from localhost ([::1]:51500 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bcYSW-00042N-Fr for patchwork-qemu-devel@patchwork.kernel.org; Wed, 24 Aug 2016 09:43:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bcYS2-000416-Lc for qemu-devel@nongnu.org; Wed, 24 Aug 2016 09:42:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bcYS1-000372-Mz for qemu-devel@nongnu.org; Wed, 24 Aug 2016 09:42:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60514) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bcYS1-00036w-HU for qemu-devel@nongnu.org; Wed, 24 Aug 2016 09:42:41 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1A9BF5D0; Wed, 24 Aug 2016 13:42:41 +0000 (UTC) Received: from dgilbert-t530.redhat.com (ovpn-116-84.ams2.redhat.com [10.36.116.84]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u7ODgX22027186; Wed, 24 Aug 2016 09:42:39 -0400 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, mst@redhat.com, amit.shah@redhat.com, quintela@redhat.com Date: Wed, 24 Aug 2016 14:42:30 +0100 Message-Id: <1472046153-22123-4-git-send-email-dgilbert@redhat.com> In-Reply-To: <1472046153-22123-1-git-send-email-dgilbert@redhat.com> References: <1472046153-22123-1-git-send-email-dgilbert@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 24 Aug 2016 13:42:41 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC 3/6] migration: Add VMSTATE_UNUSED_VARRAY_UINT32 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: cornelia.huck@de.ibm.com, duanj@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: "Dr. David Alan Gilbert" VMSTATE_UNUSED_VARRAY_UINT32 is used to skip a chunk of the stream that's an n-element array; note the array size and the dynamic value read never get multiplied so there's no overflow risk. Signed-off-by: Dr. David Alan Gilbert --- include/migration/vmstate.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index 1638ee5..a0eff5e 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -643,6 +643,17 @@ extern const VMStateInfo vmstate_info_bitmap; .flags = VMS_BUFFER, \ } +/* Discard size * field_num bytes, where field_num is a uint32 member */ +#define VMSTATE_UNUSED_VARRAY_UINT32(_state, _test, _version, _field_num, _size) {\ + .name = "unused", \ + .field_exists = (_test), \ + .num_offset = vmstate_offset_value(_state, _field_num, uint32_t),\ + .version_id = (_version), \ + .size = (_size), \ + .info = &vmstate_info_unused_buffer, \ + .flags = VMS_VARRAY_UINT32 | VMS_BUFFER, \ +} + /* _field_size should be a int32_t field in the _state struct giving the * size of the bitmap _field in bits. */