From nobody Mon Feb 9 20:35:27 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 148965508329653.522192020706484; Thu, 16 Mar 2017 02:04:43 -0700 (PDT) Received: from localhost ([::1]:41695 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1coRKs-0004YM-6W for importer@patchew.org; Thu, 16 Mar 2017 05:04:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41626) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1coRI8-0003O7-Ro for qemu-devel@nongnu.org; Thu, 16 Mar 2017 05:01:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1coRI8-00008M-1g for qemu-devel@nongnu.org; Thu, 16 Mar 2017 05:01:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44920) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1coRI7-000085-PF for qemu-devel@nongnu.org; Thu, 16 Mar 2017 05:01:51 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AAA4DC0092CB; Thu, 16 Mar 2017 09:01:51 +0000 (UTC) Received: from secure.mitica (ovpn-116-230.ams2.redhat.com [10.36.116.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C6C971C80; Thu, 16 Mar 2017 09:01:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AAA4DC0092CB Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com AAA4DC0092CB From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 16 Mar 2017 10:01:39 +0100 Message-Id: <20170316090141.13421-5-quintela@redhat.com> In-Reply-To: <20170316090141.13421-1-quintela@redhat.com> References: <20170316090141.13421-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 16 Mar 2017 09:01:51 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 4/6] vmstate: fix failed iotests case 68 and 91 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: QingFeng Hao , Halil Pasic , dgilbert@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: QingFeng Hao This problem affects s390x only if we are running without KVM. Basically, S390CPU.irqstate is unused if we do not use KVM, and thus no buffer is allocated. This causes size=3D0, first_elem=3DNULL and n_elems=3D1 in vmstate_load_state and vmstate_save_state. And the assert fails. With this fix we can go back to the old behavior and support VMS_VBUFFER with size 0 and nullptr. Signed-off-by: QingFeng Hao Signed-off-by: Halil Pasic Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Juan Quintela --- migration/vmstate.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/migration/vmstate.c b/migration/vmstate.c index 78b3cd4..7b4a607 100644 --- a/migration/vmstate.c +++ b/migration/vmstate.c @@ -109,7 +109,7 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescri= ption *vmsd, vmstate_handle_alloc(first_elem, field, opaque); if (field->flags & VMS_POINTER) { first_elem =3D *(void **)first_elem; - assert(first_elem || !n_elems); + assert(first_elem || !n_elems || !size); } for (i =3D 0; i < n_elems; i++) { void *curr_elem =3D first_elem + size * i; @@ -117,7 +117,7 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescri= ption *vmsd, if (field->flags & VMS_ARRAY_OF_POINTER) { curr_elem =3D *(void **)curr_elem; } - if (!curr_elem) { + if (!curr_elem && size) { /* if null pointer check placeholder and do not follow= */ assert(field->flags & VMS_ARRAY_OF_POINTER); ret =3D vmstate_info_nullptr.get(f, curr_elem, size, N= ULL); @@ -325,7 +325,7 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescr= iption *vmsd, trace_vmstate_save_state_loop(vmsd->name, field->name, n_elems= ); if (field->flags & VMS_POINTER) { first_elem =3D *(void **)first_elem; - assert(first_elem || !n_elems); + assert(first_elem || !n_elems || !size); } for (i =3D 0; i < n_elems; i++) { void *curr_elem =3D first_elem + size * i; @@ -336,7 +336,7 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescr= iption *vmsd, assert(curr_elem); curr_elem =3D *(void **)curr_elem; } - if (!curr_elem) { + if (!curr_elem && size) { /* if null pointer write placeholder and do not follow= */ assert(field->flags & VMS_ARRAY_OF_POINTER); vmstate_info_nullptr.put(f, curr_elem, size, NULL, NUL= L); --=20 2.9.3