From patchwork Tue Feb 12 22:32:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 220002 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 2A0232C0085 for ; Wed, 13 Feb 2013 09:33:23 +1100 (EST) Received: from localhost ([::1]:55503 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U5OPg-0003tP-UR for incoming@patchwork.ozlabs.org; Tue, 12 Feb 2013 17:33:20 -0500 Received: from eggs.gnu.org ([208.118.235.92]:44130) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U5OPX-0003t8-OK for qemu-devel@nongnu.org; Tue, 12 Feb 2013 17:33:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U5OPU-0008I9-OC for qemu-devel@nongnu.org; Tue, 12 Feb 2013 17:33:11 -0500 Received: from cantor2.suse.de ([195.135.220.15]:45330 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U5OPU-0008DH-IA for qemu-devel@nongnu.org; Tue, 12 Feb 2013 17:33:08 -0500 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 76C76A538D; Tue, 12 Feb 2013 23:32:27 +0100 (CET) From: Alexander Graf To: qemu-devel qemu-devel Date: Tue, 12 Feb 2013 23:32:21 +0100 Message-Id: <1360708343-30339-2-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.6.0.2 In-Reply-To: <1360708343-30339-1-git-send-email-agraf@suse.de> References: <1360708343-30339-1-git-send-email-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 195.135.220.15 Cc: Blue Swirl , Christian Borntraeger , Anthony Liguori Subject: [Qemu-devel] [PATCH 1/3] s390/sclpconsole: prevent char layer callback during initialization 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 From: Christian Borntraeger Starting a qemu with an sclp console and pressing a key very early can result in "qemu-system-s390x: hw/s390x/sclpconsole.c:60: receive_from_chr_layer: Assertion `scon->iov' failed." Lets make sure that the init process is finished, since the iov is allocated after CHR_EVENT_OPENED by also checking for scon->iov. Signed-off-by: Christian Borntraeger Signed-off-by: Alexander Graf --- hw/s390x/sclpconsole.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-) diff --git a/hw/s390x/sclpconsole.c b/hw/s390x/sclpconsole.c index adc0ee8..effe511 100644 --- a/hw/s390x/sclpconsole.c +++ b/hw/s390x/sclpconsole.c @@ -44,12 +44,9 @@ typedef struct SCLPConsole { /* Return number of bytes that fit into iov buffer */ static int chr_can_read(void *opaque) { - int can_read; SCLPConsole *scon = opaque; - can_read = SIZE_BUFFER_VT220 - scon->iov_data_len; - - return can_read; + return scon->iov ? SIZE_BUFFER_VT220 - scon->iov_data_len : 0; } /* Receive n bytes from character layer, save in iov buffer,