From patchwork Fri Apr 30 11:13:55 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Shah X-Patchwork-Id: 51325 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D9F0AB7D17 for ; Fri, 30 Apr 2010 21:20:57 +1000 (EST) Received: from localhost ([127.0.0.1]:45353 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O7oDK-0007ZE-Uh for incoming@patchwork.ozlabs.org; Fri, 30 Apr 2010 07:16:58 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O7oC7-0007Xd-Lz for qemu-devel@nongnu.org; Fri, 30 Apr 2010 07:15:43 -0400 Received: from [140.186.70.92] (port=41829 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O7oC6-0007Wn-HS for qemu-devel@nongnu.org; Fri, 30 Apr 2010 07:15:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O7oC4-0007UJ-UT for qemu-devel@nongnu.org; Fri, 30 Apr 2010 07:15:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35932) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O7oC4-0007U8-Mp for qemu-devel@nongnu.org; Fri, 30 Apr 2010 07:15:40 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o3UBFbs7003896 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 30 Apr 2010 07:15:37 -0400 Received: from localhost (vpn-240-4.phx2.redhat.com [10.3.240.4]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o3UBFZMv022399; Fri, 30 Apr 2010 07:15:36 -0400 From: Amit Shah To: Anthony Liguori Date: Fri, 30 Apr 2010 16:43:55 +0530 Message-Id: <1272626035-14416-1-git-send-email-amit.shah@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Amit Shah , qemu list , Juan Quintela Subject: [Qemu-devel] [PATCH] virtio-serial: Fix check for 'assert'; prevent NULL derefs X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org In the flush_queued_data() function, we expect port to be valid. Assert only for port and not port || discard. Reported-by: Juan Quintela Signed-off-by: Amit Shah reviewed-by: Juan Quintela --- hw/virtio-serial-bus.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c index 97694d5..3ce95e8 100644 --- a/hw/virtio-serial-bus.c +++ b/hw/virtio-serial-bus.c @@ -137,7 +137,7 @@ static void do_flush_queued_data(VirtIOSerialPort *port, VirtQueue *vq, static void flush_queued_data(VirtIOSerialPort *port, bool discard) { - assert(port || discard); + assert(port); do_flush_queued_data(port, port->ovq, &port->vser->vdev, discard); }